home *** CD-ROM | disk | FTP | other *** search
/ Mac Power 1997 January / macpower199701.bin / AMUG / Programming_10 / Videotoolbox 96-08-22-c.sit / VideoToolbox / VideoToolboxSources / NoisePdfFill.c < prev    next >
MacBinary  |  1996-04-03  |  16.9 KB  |  [TEXT/CWIE]

open in: MacOS 8.1     |     Win98     |     DOS

view JSON data     |     view as text

This file was processed as: MacBinary (archive/macBinary).

You can browse this item here: NoisePdfFill.c

ConfidenceProgramDetectionMatch TypeSupport
66% dexvert Compact Compressed (Unix) (archive/compact) ext Supported
10% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, inited, Wed Apr 3 22:49:06 1996, modified Wed Apr 3 22:49:06 1996, creator 'CWIE', type ASCII, 16519 bytes "NoisePdfFill.c" , at 0x4107 456 bytes resource default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[CWIE]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 0e 4e 6f 69 73 65 50 | 64 66 46 69 6c 6c 2e 63 |..NoiseP|dfFill.c|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 43 57 49 | 45 01 00 00 00 00 00 00 |.TEXTCWI|E.......|
|00000050| 00 00 00 00 00 40 87 00 | 00 01 c8 ad 88 f7 32 ad |.....@..|......2.|
|00000060| 88 f7 32 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |..2.....|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 ea 6b 00 00 |........|.....k..|
|00000080| 2f 2a 0d 4e 6f 69 73 65 | 50 64 66 46 69 6c 6c 2e |/*.Noise|PdfFill.|
|00000090| 63 0d 0d 65 72 72 6f 72 | 3d 4e 6f 69 73 65 50 64 |c..error|=NoisePd|
|000000a0| 66 46 69 6c 6c 28 77 6f | 72 6c 64 2c 26 72 65 63 |fFill(wo|rld,&rec|
|000000b0| 74 2c 70 64 66 4b 69 6e | 64 2c 26 6d 65 61 6e 2c |t,pdfKin|d,&mean,|
|000000c0| 26 73 64 2c 6d 69 6e 2c | 6d 61 78 29 3b 0d 65 72 |&sd,min,|max);.er|
|000000d0| 72 6f 72 3d 4e 6f 69 73 | 65 50 64 66 41 64 64 28 |ror=Nois|ePdfAdd(|
|000000e0| 77 6f 72 6c 64 2c 26 72 | 65 63 74 2c 70 64 66 4b |world,&r|ect,pdfK|
|000000f0| 69 6e 64 2c 26 6d 65 61 | 6e 2c 26 73 64 2c 6d 69 |ind,&mea|n,&sd,mi|
|00000100| 6e 2c 6d 61 78 29 3b 0d | 0d 47 65 6e 65 72 61 74 |n,max);.|.Generat|
|00000110| 65 20 67 6f 6f 64 20 6e | 6f 69 73 65 20 69 6d 61 |e good n|oise ima|
|00000120| 67 65 73 20 71 75 69 63 | 6b 6c 79 2e 20 59 6f 75 |ges quic|kly. You|
|00000130| 20 73 75 70 70 6c 79 20 | 61 20 47 57 6f 72 6c 64 | supply |a GWorld|
|00000140| 20 28 6f 72 20 61 20 77 | 69 6e 64 6f 77 29 20 61 | (or a w|indow) a|
|00000150| 6e 64 20 61 20 72 65 63 | 74 0d 69 6e 64 69 63 61 |nd a rec|t.indica|
|00000160| 74 69 6e 67 20 68 6f 77 | 20 6d 75 63 68 20 6f 66 |ting how| much of|
|00000170| 20 69 74 20 74 6f 20 66 | 69 6c 6c 20 77 69 74 68 | it to f|ill with|
|00000180| 20 6e 6f 69 73 65 2e 20 | 22 77 6f 72 6c 64 22 20 | noise. |"world" |
|00000190| 6d 61 79 20 62 65 20 61 | 20 70 6f 69 6e 74 65 72 |may be a| pointer|
|000001a0| 20 74 6f 20 61 0d 47 57 | 6f 72 6c 64 2c 20 61 20 | to a.GW|orld, a |
|000001b0| 63 6f 6c 6f 72 20 43 57 | 69 6e 64 6f 77 2c 20 6f |color CW|indow, o|
|000001c0| 72 2c 20 77 69 74 68 20 | 63 61 73 74 69 6e 67 2c |r, with |casting,|
|000001d0| 20 61 20 70 6c 61 69 6e | 2d 6f 6c 64 20 57 69 6e | a plain|-old Win|
|000001e0| 64 6f 77 2e 20 4e 6f 69 | 73 65 50 64 66 46 69 6c |dow. Noi|sePdfFil|
|000001f0| 6c 20 66 69 6c 6c 73 0d | 74 68 65 20 70 69 78 65 |l fills.|the pixe|
|00000200| 6c 73 20 77 69 74 68 69 | 6e 20 72 65 63 74 20 77 |ls withi|n rect w|
|00000210| 69 74 68 20 6e 6f 69 73 | 65 3b 20 4e 6f 69 73 65 |ith nois|e; Noise|
|00000220| 50 64 66 41 64 64 20 61 | 64 64 73 20 6e 6f 69 73 |PdfAdd a|dds nois|
|00000230| 65 20 74 6f 20 74 68 65 | 6d 2e 20 45 61 63 68 20 |e to the|m. Each |
|00000240| 70 69 78 65 6c 0d 77 69 | 6c 6c 20 67 65 74 20 61 |pixel.wi|ll get a|
|00000250| 6e 20 69 6e 64 65 70 65 | 6e 64 65 6e 74 20 69 6e |n indepe|ndent in|
|00000260| 74 65 67 65 72 20 73 61 | 6d 70 6c 65 20 66 72 6f |teger sa|mple fro|
|00000270| 6d 20 61 20 73 70 65 63 | 69 66 69 65 64 20 70 72 |m a spec|ified pr|
|00000280| 6f 62 61 62 69 6c 69 74 | 79 20 64 65 6e 73 69 74 |obabilit|y densit|
|00000290| 79 0d 66 75 6e 63 74 69 | 6f 6e 20 28 70 64 66 29 |y.functi|on (pdf)|
|000002a0| 3a 20 6b 42 69 6e 61 72 | 79 50 64 66 2c 20 6b 55 |: kBinar|yPdf, kU|
|000002b0| 6e 69 66 6f 72 6d 50 64 | 66 2c 20 6f 72 20 6b 47 |niformPd|f, or kG|
|000002c0| 61 75 73 73 69 61 6e 50 | 64 66 2e 20 28 41 20 66 |aussianP|df. (A f|
|000002d0| 6f 75 72 74 68 20 70 64 | 66 2c 0d 6b 42 69 6e 6f |ourth pd|f,.kBino|
|000002e0| 6d 69 61 6c 50 64 66 2c | 20 69 73 20 6e 6f 74 20 |mialPdf,| is not |
|000002f0| 72 65 63 6f 6d 6d 65 6e | 64 65 64 2e 29 20 59 6f |recommen|ded.) Yo|
|00000300| 75 20 73 70 65 63 69 66 | 79 20 74 68 65 20 70 64 |u specif|y the pd|
|00000310| 66 20 6b 69 6e 64 2c 20 | 6d 65 61 6e 2c 20 61 6e |f kind, |mean, an|
|00000320| 64 0d 22 75 6e 63 6c 69 | 70 70 65 64 22 20 73 74 |d."uncli|pped" st|
|00000330| 61 6e 64 61 72 64 20 64 | 65 76 69 61 74 69 6f 6e |andard d|eviation|
|00000340| 2e 20 54 68 65 20 6c 61 | 73 74 20 74 77 6f 20 61 |. The la|st two a|
|00000350| 72 67 75 6d 65 6e 74 73 | 2c 20 22 6d 69 6e 22 20 |rguments|, "min" |
|00000360| 61 6e 64 20 22 6d 61 78 | 22 2c 20 61 72 65 20 75 |and "max|", are u|
|00000370| 73 65 64 0d 74 6f 20 63 | 6c 69 70 2c 20 69 2e 65 |sed.to c|lip, i.e|
|00000380| 2e 20 72 65 73 74 72 69 | 63 74 20 74 68 65 20 72 |. restri|ct the r|
|00000390| 61 6e 67 65 20 6f 66 20 | 74 68 65 20 70 64 66 20 |ange of |the pdf |
|000003a0| 28 65 2e 67 2e 20 74 6f | 20 70 72 65 63 6c 75 64 |(e.g. to| preclud|
|000003b0| 65 20 6f 76 65 72 66 6c | 6f 77 20 69 6e 20 79 6f |e overfl|ow in yo|
|000003c0| 75 72 0d 69 6d 61 67 65 | 20 70 69 78 65 6c 73 29 |ur.image| pixels)|
|000003d0| 2e 20 49 6e 20 74 68 65 | 20 63 61 73 65 73 20 6f |. In the| cases o|
|000003e0| 66 20 6b 55 6e 69 66 6f | 72 6d 50 64 66 2c 20 6b |f kUnifo|rmPdf, k|
|000003f0| 42 69 6e 6f 6d 69 61 6c | 50 64 66 2c 20 61 6e 64 |Binomial|Pdf, and|
|00000400| 20 6b 47 61 75 73 73 69 | 61 6e 50 64 66 2c 0d 73 | kGaussi|anPdf,.s|
|00000410| 61 6d 70 6c 65 73 20 66 | 61 6c 6c 69 6e 67 20 6f |amples f|alling o|
|00000420| 75 74 73 69 64 65 20 74 | 68 65 20 72 61 6e 67 65 |utside t|he range|
|00000430| 20 5b 6d 69 6e 2c 6d 61 | 78 5d 20 61 72 65 20 64 | [min,ma|x] are d|
|00000440| 69 73 63 61 72 64 65 64 | 20 61 6e 64 20 72 65 70 |iscarded| and rep|
|00000450| 6c 61 63 65 64 20 62 79 | 0d 69 6e 64 65 70 65 6e |laced by|.indepen|
|00000460| 64 65 6e 74 20 6e 65 77 | 20 73 61 6d 70 6c 65 73 |dent new| samples|
|00000470| 2e 20 49 6e 20 74 68 65 | 20 63 61 73 65 20 6f 66 |. In the| case of|
|00000480| 20 6b 42 69 6e 61 72 79 | 2c 20 65 61 63 68 20 73 | kBinary|, each s|
|00000490| 61 6d 70 6c 65 20 68 61 | 73 20 6f 6e 65 20 6f 66 |ample ha|s one of|
|000004a0| 20 6f 6e 6c 79 20 74 77 | 6f 0d 76 61 6c 75 65 73 | only tw|o.values|
|000004b0| 2c 20 77 69 74 68 20 65 | 71 75 61 6c 20 70 72 6f |, with e|qual pro|
|000004c0| 62 61 62 69 6c 69 74 79 | 3b 20 74 68 65 73 65 20 |bability|; these |
|000004d0| 74 77 6f 20 76 61 6c 75 | 65 73 20 61 72 65 20 69 |two valu|es are i|
|000004e0| 6e 69 74 69 61 6c 6c 79 | 20 73 65 74 20 74 6f 20 |nitially| set to |
|000004f0| 6d 65 61 6e b1 73 64 2c | 20 74 6f 0d 79 69 65 6c |mean.sd,| to.yiel|
|00000500| 64 20 74 68 65 20 64 65 | 73 69 72 65 64 20 6d 65 |d the de|sired me|
|00000510| 61 6e 20 61 6e 64 20 73 | 64 2c 20 62 75 74 20 74 |an and s|d, but t|
|00000520| 68 65 79 20 61 72 65 20 | 61 64 6a 75 73 74 65 64 |hey are |adjusted|
|00000530| 2c 20 69 66 20 6e 65 63 | 65 73 73 61 72 79 2c 20 |, if nec|essary, |
|00000540| 74 6f 20 62 72 69 6e 67 | 20 74 68 65 6d 0d 77 69 |to bring| them.wi|
|00000550| 74 68 69 6e 20 74 68 65 | 20 72 61 6e 67 65 20 5b |thin the| range [|
|00000560| 6d 69 6e 2c 6d 61 78 5d | 2e 20 55 70 6f 6e 20 72 |min,max]|. Upon r|
|00000570| 65 74 75 72 6e 2c 20 74 | 68 65 20 6d 65 61 6e 20 |eturn, t|he mean |
|00000580| 61 6e 64 20 73 64 20 61 | 72 67 75 6d 65 6e 74 73 |and sd a|rguments|
|00000590| 20 28 77 68 69 63 68 20 | 61 72 65 0d 70 61 73 73 | (which |are.pass|
|000005a0| 65 64 20 62 79 20 72 65 | 66 65 72 65 6e 63 65 2c |ed by re|ference,|
|000005b0| 20 69 2e 65 2e 20 62 79 | 20 61 64 64 72 65 73 73 | i.e. by| address|
|000005c0| 2c 20 6e 6f 74 20 62 79 | 20 76 61 6c 75 65 29 20 |, not by| value) |
|000005d0| 72 65 74 75 72 6e 20 74 | 68 65 20 6d 65 61 6e 20 |return t|he mean |
|000005e0| 61 6e 64 20 73 74 61 6e | 64 61 72 64 0d 64 65 76 |and stan|dard.dev|
|000005f0| 69 61 74 69 6f 6e 20 6f | 66 20 74 68 65 20 72 61 |iation o|f the ra|
|00000600| 6e 64 6f 6d 20 67 65 6e | 65 72 61 74 6f 72 20 6f |ndom gen|erator o|
|00000610| 66 20 74 68 65 20 73 61 | 6d 70 6c 65 73 20 28 69 |f the sa|mples (i|
|00000620| 2e 65 2e 20 74 68 65 20 | 63 6c 69 70 70 65 64 20 |.e. the |clipped |
|00000630| 70 64 66 29 2e 0d 0d 54 | 68 65 20 72 65 71 75 65 |pdf)...T|he reque|
|00000640| 73 74 65 64 20 73 74 61 | 6e 64 61 72 64 20 64 65 |sted sta|ndard de|
|00000650| 76 69 61 74 69 6f 6e 2c | 20 73 64 2c 20 6d 75 73 |viation,| sd, mus|
|00000660| 74 20 62 65 20 67 72 65 | 61 74 65 72 20 74 68 61 |t be gre|ater tha|
|00000670| 6e 20 6f 72 20 65 71 75 | 61 6c 20 74 6f 20 7a 65 |n or equ|al to ze|
|00000680| 72 6f 2e 20 54 68 65 0d | 73 70 65 63 69 61 6c 20 |ro. The.|special |
|00000690| 63 61 73 65 20 6f 66 20 | 7a 65 72 6f 20 73 74 61 |case of |zero sta|
|000006a0| 6e 64 61 72 64 20 64 65 | 76 69 61 74 69 6f 6e 20 |ndard de|viation |
|000006b0| 69 73 20 72 65 63 6f 67 | 6e 69 7a 65 64 20 61 6e |is recog|nized an|
|000006c0| 64 20 70 65 72 66 6f 72 | 6d 65 64 20 71 75 69 63 |d perfor|med quic|
|000006d0| 6b 6c 79 2c 0d 70 72 6f | 64 75 63 69 6e 67 20 61 |kly,.pro|ducing a|
|000006e0| 20 75 6e 69 66 6f 72 6d | 20 69 6d 61 67 65 20 77 | uniform| image w|
|000006f0| 69 74 68 20 73 70 65 63 | 69 66 69 65 64 20 6d 65 |ith spec|ified me|
|00000700| 61 6e 2e 20 41 20 72 65 | 71 75 65 73 74 20 66 6f |an. A re|quest fo|
|00000710| 72 20 61 6e 20 75 6e 61 | 63 68 69 65 76 61 62 6c |r an una|chievabl|
|00000720| 79 20 6c 6f 77 2c 0d 62 | 75 74 20 6e 6f 6e 7a 65 |y low,.b|ut nonze|
|00000730| 72 6f 2c 20 73 64 20 77 | 69 6c 6c 20 62 65 20 73 |ro, sd w|ill be s|
|00000740| 65 72 76 65 64 20 62 79 | 20 70 72 6f 76 69 64 69 |erved by| providi|
|00000750| 6e 67 20 74 68 65 20 6c | 6f 77 65 73 74 20 61 63 |ng the l|owest ac|
|00000760| 68 69 65 76 61 62 6c 65 | 20 73 64 20 28 67 69 76 |hievable| sd (giv|
|00000770| 65 6e 20 74 68 65 0d 73 | 70 65 63 69 66 69 65 64 |en the.s|pecified|
|00000780| 20 6d 69 6e 20 61 6e 64 | 20 6d 61 78 29 2c 20 6f | min and| max), o|
|00000790| 6e 20 74 68 65 20 70 72 | 65 6d 69 73 20 74 68 61 |n the pr|emis tha|
|000007a0| 74 20 74 68 65 20 75 73 | 65 72 20 63 61 72 65 73 |t the us|er cares|
|000007b0| 20 6d 6f 73 74 20 61 62 | 6f 75 74 20 6c 6f 67 20 | most ab|out log |
|000007c0| 73 64 2c 20 73 6f 0d 74 | 68 61 74 20 74 68 65 20 |sd, so.t|hat the |
|000007d0| 6c 65 61 73 74 20 70 6f | 73 73 69 62 6c 65 20 6e |least po|ssible n|
|000007e0| 6f 6e 7a 65 72 6f 20 73 | 64 20 77 69 6c 6c 20 62 |onzero s|d will b|
|000007f0| 65 20 61 20 62 65 74 74 | 65 72 20 61 70 70 72 6f |e a bett|er appro|
|00000800| 78 69 6d 61 74 69 6f 6e | 20 74 6f 20 61 6e 0d 75 |ximation| to an.u|
|00000810| 6e 61 63 68 69 65 76 61 | 62 6c 79 20 6c 6f 77 20 |nachieva|bly low |
|00000820| 73 64 20 74 68 61 6e 20 | 77 6f 75 6c 64 20 7a 65 |sd than |would ze|
|00000830| 72 6f 20 73 64 2e 20 53 | 75 70 70 6c 79 69 6e 67 |ro sd. S|upplying|
|00000840| 20 61 6e 20 73 64 20 6f | 66 20 49 4e 46 20 77 69 | an sd o|f INF wi|
|00000850| 6c 6c 20 70 72 6f 64 75 | 63 65 0d 73 61 6d 70 6c |ll produ|ce.sampl|
|00000860| 65 73 20 77 69 74 68 20 | 76 61 6c 75 65 73 20 6f |es with |values o|
|00000870| 66 20 6d 69 6e 20 61 6e | 64 20 6d 61 78 20 69 66 |f min an|d max if|
|00000880| 20 74 68 65 20 70 64 66 | 20 6b 69 6e 64 20 69 73 | the pdf| kind is|
|00000890| 20 6b 42 69 6e 61 72 79 | 50 64 66 2c 20 61 6e 64 | kBinary|Pdf, and|
|000008a0| 20 77 69 6c 6c 0d 70 72 | 6f 64 75 63 65 20 61 20 | will.pr|oduce a |
|000008b0| 75 6e 69 66 6f 72 6d 20 | 64 69 73 74 72 69 62 75 |uniform |distribu|
|000008c0| 74 69 6f 6e 20 6f 76 65 | 72 20 74 68 65 20 72 61 |tion ove|r the ra|
|000008d0| 6e 67 65 20 5b 6d 69 6e | 2c 6d 61 78 5d 20 69 66 |nge [min|,max] if|
|000008e0| 20 74 68 65 20 70 64 66 | 20 69 73 0d 6b 55 6e 69 | the pdf| is.kUni|
|000008f0| 66 6f 72 6d 50 64 66 2c | 20 6b 47 61 75 73 73 69 |formPdf,| kGaussi|
|00000900| 61 6e 50 64 66 2c 20 6f | 72 20 6b 42 69 6e 6f 6d |anPdf, o|r kBinom|
|00000910| 69 61 6c 50 64 66 2e 0d | 0d 22 6d 61 78 22 20 6d |ialPdf..|."max" m|
|00000920| 75 73 74 20 62 65 20 67 | 72 65 61 74 65 72 20 74 |ust be g|reater t|
|00000930| 68 61 6e 20 6f 72 20 65 | 71 75 61 6c 20 74 6f 20 |han or e|qual to |
|00000940| 22 6d 65 61 6e 22 2c 20 | 77 68 69 63 68 20 6d 75 |"mean", |which mu|
|00000950| 73 74 20 62 65 20 67 72 | 65 61 74 65 72 20 74 68 |st be gr|eater th|
|00000960| 61 6e 20 6f 72 0d 65 71 | 75 61 6c 20 74 6f 20 22 |an or.eq|ual to "|
|00000970| 6d 69 6e 22 2e 20 4e 6f | 72 6d 61 6c 6c 79 2c 20 |min". No|rmally, |
|00000980| 69 6d 61 67 65 20 70 69 | 78 65 6c 73 20 61 72 65 |image pi|xels are|
|00000990| 20 63 6f 6e 73 69 64 65 | 72 65 64 20 70 6f 73 69 | conside|red posi|
|000009a0| 74 69 76 65 20 61 6e 64 | 20 79 6f 75 27 6c 6c 20 |tive and| you'll |
|000009b0| 77 61 6e 74 20 74 6f 0d | 6d 61 6b 65 20 22 6d 69 |want to.|make "mi|
|000009c0| 6e 22 20 67 72 65 61 74 | 65 72 20 74 68 61 6e 20 |n" great|er than |
|000009d0| 6f 72 20 65 71 75 61 6c | 20 74 6f 20 7a 65 72 6f |or equal| to zero|
|000009e0| 2c 20 62 75 74 20 74 68 | 69 73 20 69 73 20 6e 6f |, but th|is is no|
|000009f0| 74 20 65 6e 66 6f 72 63 | 65 64 20 62 79 0d 4e 6f |t enforc|ed by.No|
|00000a00| 69 73 65 50 64 66 46 69 | 6c 6c 3b 20 65 2e 67 2e |isePdfFi|ll; e.g.|
|00000a10| 20 79 6f 75 20 63 61 6e | 20 61 64 64 20 7a 65 72 | you can| add zer|
|00000a20| 6f 2d 6d 65 61 6e 20 6e | 6f 69 73 65 20 74 6f 20 |o-mean n|oise to |
|00000a30| 61 20 70 6f 73 69 74 69 | 76 65 20 69 6d 61 67 65 |a positi|ve image|
|00000a40| 2e 20 0d 0d 43 61 6c 6c | 69 6e 67 20 4e 6f 69 73 |. ..Call|ing Nois|
|00000a50| 65 50 64 66 41 64 64 20 | 77 69 74 68 20 61 20 22 |ePdfAdd |with a "|
|00000a60| 6d 69 6e 22 3c 30 20 73 | 68 6f 75 6c 64 20 77 6f |min"<0 s|hould wo|
|00000a70| 72 6b 20 70 65 72 66 65 | 63 74 6c 79 20 28 74 68 |rk perfe|ctly (th|
|00000a80| 6f 75 67 68 20 69 74 20 | 68 61 73 6e 27 74 20 62 |ough it |hasn't b|
|00000a90| 65 65 6e 0d 74 65 73 74 | 65 64 29 2c 20 62 75 74 |een.test|ed), but|
|00000aa0| 20 6d 61 79 20 62 65 20 | 73 69 67 6e 69 66 69 63 | may be |signific|
|00000ab0| 61 6e 74 6c 79 20 73 6c | 6f 77 65 72 20 74 68 61 |antly sl|ower tha|
|00000ac0| 6e 20 77 68 65 6e 20 22 | 6d 69 6e 22 b3 30 2e 20 |n when "|min".0. |
|00000ad0| 4e 6f 69 73 65 50 64 66 | 41 64 64 28 29 20 75 73 |NoisePdf|Add() us|
|00000ae0| 65 73 0d 4e 6f 69 73 65 | 50 64 66 46 69 6c 6c 28 |es.Noise|PdfFill(|
|00000af0| 29 20 74 6f 20 6d 61 6b | 65 20 74 68 65 20 6e 6f |) to mak|e the no|
|00000b00| 69 73 65 20 69 6e 20 61 | 20 74 65 6d 70 6f 72 61 |ise in a| tempora|
|00000b10| 72 79 20 6e 65 77 20 47 | 57 6f 72 6c 64 20 61 6e |ry new G|World an|
|00000b20| 64 20 74 68 65 6e 20 63 | 61 6c 6c 73 0d 43 6f 70 |d then c|alls.Cop|
|00000b30| 79 57 69 6e 64 6f 77 73 | 20 74 6f 20 61 64 64 20 |yWindows| to add |
|00000b40| 74 68 65 20 6e 6f 69 73 | 65 20 74 6f 20 79 6f 75 |the nois|e to you|
|00000b50| 72 20 69 6d 61 67 65 2e | 20 49 66 20 22 6d 69 6e |r image.| If "min|
|00000b60| 22 b3 30 20 74 68 65 6e | 20 4e 6f 69 73 65 50 64 |".0 then| NoisePd|
|00000b70| 66 41 64 64 28 29 20 75 | 73 65 73 20 61 0d 66 61 |fAdd() u|ses a.fa|
|00000b80| 73 74 20 70 61 72 61 6c | 6c 65 6c 20 61 64 64 69 |st paral|lel addi|
|00000b90| 74 69 6f 6e 20 74 68 61 | 74 20 61 73 73 75 6d 65 |tion tha|t assume|
|00000ba0| 73 20 74 68 65 72 65 20 | 77 69 6c 6c 20 62 65 20 |s there |will be |
|00000bb0| 6e 6f 20 6f 76 65 72 66 | 6c 6f 77 20 69 6e 20 65 |no overf|low in e|
|00000bc0| 61 63 68 20 70 69 78 65 | 6c 27 73 0d 61 72 69 74 |ach pixe|l's.arit|
|00000bd0| 68 6d 65 74 69 63 2c 20 | 73 6f 20 74 68 65 20 75 |hmetic, |so the u|
|00000be0| 73 65 72 20 73 68 6f 75 | 6c 64 20 74 61 6b 65 20 |ser shou|ld take |
|00000bf0| 63 61 72 65 20 74 6f 20 | 73 70 65 63 69 66 79 20 |care to |specify |
|00000c00| 61 20 22 6d 61 78 22 20 | 74 68 61 74 20 77 69 6c |a "max" |that wil|
|00000c10| 6c 20 69 6e 64 65 65 64 | 0d 70 72 65 76 65 6e 74 |l indeed|.prevent|
|00000c20| 20 6f 76 65 72 66 6c 6f | 77 2c 20 73 69 6e 63 65 | overflo|w, since|
|00000c30| 20 61 6e 79 20 6f 76 65 | 72 66 6c 6f 77 20 77 6f | any ove|rflow wo|
|00000c40| 75 6c 64 20 61 66 66 65 | 63 74 20 61 20 6e 65 69 |uld affe|ct a nei|
|00000c50| 67 68 62 6f 72 69 6e 67 | 20 70 69 78 65 6c 2e 20 |ghboring| pixel. |
|00000c60| 49 66 20 22 6d 69 6e 22 | 3c 30 0d 74 68 65 6e 20 |If "min"|<0.then |
|00000c70| 74 68 65 20 75 6e 73 69 | 67 6e 65 64 20 61 64 64 |the unsi|gned add|
|00000c80| 69 74 69 6f 6e 20 6f 66 | 20 22 6e 65 67 61 74 69 |ition of| "negati|
|00000c90| 76 65 22 20 77 69 74 68 | 20 70 6f 73 69 74 69 76 |ve" with| positiv|
|00000ca0| 65 20 70 69 78 65 6c 73 | 20 74 6f 20 70 72 6f 64 |e pixels| to prod|
|00000cb0| 75 63 65 20 70 6f 73 69 | 74 69 76 65 0d 70 69 78 |uce posi|tive.pix|
|00000cc0| 65 6c 73 20 77 69 6c 6c | 20 22 6f 76 65 72 66 6c |els will| "overfl|
|00000cd0| 6f 77 22 20 69 6e 20 74 | 68 65 20 6e 6f 72 6d 61 |ow" in t|he norma|
|00000ce0| 6c 20 63 6f 75 72 73 65 | 20 6f 66 20 63 6f 6d 70 |l course| of comp|
|00000cf0| 75 74 69 6e 67 20 74 68 | 65 20 73 75 6d 20 75 73 |uting th|e sum us|
|00000d00| 69 6e 67 20 75 6e 73 69 | 67 6e 65 64 0d 61 72 69 |ing unsi|gned.ari|
|00000d10| 74 68 6d 65 74 69 63 2e | 20 54 68 65 20 62 69 74 |thmetic.| The bit|
|00000d20| 73 20 6f 66 20 74 68 65 | 20 70 69 78 65 6c 20 69 |s of the| pixel i|
|00000d30| 74 73 65 6c 66 20 77 69 | 6c 6c 20 62 65 20 63 6f |tself wi|ll be co|
|00000d40| 72 72 65 63 74 2c 20 62 | 75 74 20 74 68 65 20 6f |rrect, b|ut the o|
|00000d50| 76 65 72 66 6c 6f 77 20 | 77 6f 75 6c 64 0d 61 66 |verflow |would.af|
|00000d60| 66 65 63 74 20 61 20 6e | 65 69 67 68 62 6f 72 69 |fect a n|eighbori|
|00000d70| 6e 67 20 70 69 78 65 6c | 20 69 66 20 70 61 72 61 |ng pixel| if para|
|00000d80| 6c 6c 65 6c 20 61 64 64 | 69 74 69 6f 6e 20 77 65 |llel add|ition we|
|00000d90| 72 65 20 75 73 65 64 2c | 20 73 6f 20 74 68 65 20 |re used,| so the |
|00000da0| 61 64 64 69 74 69 6f 6e | 73 20 61 72 65 0d 64 6f |addition|s are.do|
|00000db0| 6e 65 20 69 6e 64 65 70 | 65 6e 64 65 6e 74 6c 79 |ne indep|endently|
|00000dc0| 2c 20 6f 6e 65 20 70 69 | 78 65 6c 20 61 74 20 61 |, one pi|xel at a|
|00000dd0| 20 74 69 6d 65 2c 20 77 | 68 69 63 68 20 74 61 6b | time, w|hich tak|
|00000de0| 65 73 20 6c 6f 6e 67 65 | 72 2e 0d 0d 6b 42 69 6e |es longe|r...kBin|
|00000df0| 61 72 79 50 64 66 2c 20 | 6b 55 6e 69 66 6f 72 6d |aryPdf, |kUniform|
|00000e00| 50 64 66 2c 20 61 6e 64 | 20 6b 47 61 75 73 73 69 |Pdf, and| kGaussi|
|00000e10| 61 6e 50 64 66 20 73 68 | 6f 75 6c 64 20 61 6c 6c |anPdf sh|ould all|
|00000e20| 20 62 65 20 75 73 65 66 | 75 6c 2e 20 57 65 20 75 | be usef|ul. We u|
|00000e30| 73 65 0d 6b 47 61 75 73 | 73 69 61 6e 50 64 66 20 |se.kGaus|sianPdf |
|00000e40| 69 6e 20 6d 6f 73 74 20 | 6f 66 20 6f 75 72 20 6e |in most |of our n|
|00000e50| 6f 69 73 65 2d 6d 61 73 | 6b 69 6e 67 20 77 6f 72 |oise-mas|king wor|
|00000e60| 6b 2c 20 62 75 74 20 66 | 6f 72 20 64 79 6e 61 6d |k, but f|or dynam|
|00000e70| 69 63 20 6e 6f 69 73 65 | 20 77 65 0d 73 6f 6d 65 |ic noise| we.some|
|00000e80| 74 69 6d 65 73 20 75 73 | 65 20 6b 42 69 6e 61 72 |times us|e kBinar|
|00000e90| 79 50 64 66 20 69 6e 20 | 6f 72 64 65 72 20 74 6f |yPdf in |order to|
|00000ea0| 20 61 63 68 69 65 76 65 | 20 6d 6f 72 65 20 6e 6f | achieve| more no|
|00000eb0| 69 73 65 20 70 6f 77 65 | 72 2c 20 61 73 73 75 6d |ise powe|r, assum|
|00000ec0| 69 6e 67 20 74 68 61 74 | 20 74 68 65 0d 6f 62 73 |ing that| the.obs|
|00000ed0| 65 72 76 65 72 20 77 69 | 6c 6c 20 76 69 73 75 61 |erver wi|ll visua|
|00000ee0| 6c 6c 79 20 69 6e 74 65 | 67 72 61 74 65 20 73 65 |lly inte|grate se|
|00000ef0| 76 65 72 61 6c 20 6f 66 | 20 74 68 65 20 64 79 6e |veral of| the dyn|
|00000f00| 61 6d 69 63 20 66 72 61 | 6d 65 73 2c 20 62 6c 75 |amic fra|mes, blu|
|00000f10| 72 72 69 6e 67 20 74 68 | 65 0d 64 69 73 74 69 6e |rring th|e.distin|
|00000f20| 63 74 69 6f 6e 20 62 65 | 74 77 65 65 6e 20 70 64 |ction be|tween pd|
|00000f30| 66 27 73 2e 20 50 72 65 | 73 75 6d 61 62 6c 79 20 |f's. Pre|sumably |
|00000f40| 74 68 65 20 74 68 72 65 | 65 20 6b 69 6e 64 73 20 |the thre|e kinds |
|00000f50| 6f 66 20 6e 6f 69 73 65 | 20 77 6f 75 6c 64 20 62 |of noise| would b|
|00000f60| 65 20 76 69 73 75 61 6c | 6c 79 0d 69 6e 64 69 73 |e visual|ly.indis|
|00000f70| 74 69 6e 67 75 69 73 68 | 61 62 6c 65 20 69 66 20 |tinguish|able if |
|00000f80| 73 68 6f 77 6e 20 77 69 | 74 68 20 69 6e 64 65 70 |shown wi|th indep|
|00000f90| 65 6e 64 65 6e 74 20 31 | 35 20 6d 73 20 66 72 61 |endent 1|5 ms fra|
|00000fa0| 6d 65 73 20 61 6e 64 20 | 65 71 75 61 6c 20 73 64 |mes and |equal sd|
|00000fb0| 2e 0d 0d 6b 42 69 6e 6f | 6d 69 61 6c 50 64 66 20 |...kBino|mialPdf |
|00000fc0| 77 6f 72 6b 73 20 66 69 | 6e 65 2c 20 62 75 74 20 |works fi|ne, but |
|00000fd0| 69 73 20 6e 6f 74 20 72 | 65 63 6f 6d 6d 65 6e 64 |is not r|ecommend|
|00000fe0| 65 64 2e 20 54 68 65 20 | 6b 42 69 6e 6f 6d 69 61 |ed. The |kBinomia|
|00000ff0| 6c 50 64 66 20 63 6f 64 | 65 20 75 73 65 73 20 74 |lPdf cod|e uses t|
|00001000| 68 65 0d 66 61 63 74 20 | 74 68 61 74 20 74 68 65 |he.fact |that the|
|00001010| 20 6e 75 6d 62 65 72 20 | 6f 66 20 68 65 61 64 73 | number |of heads|
|00001020| 20 69 6e 20 32 34 20 63 | 6f 69 6e 20 74 6f 73 73 | in 24 c|oin toss|
|00001030| 65 73 20 69 73 20 61 70 | 70 72 6f 78 69 6d 61 74 |es is ap|proximat|
|00001040| 65 6c 79 20 67 61 75 73 | 73 69 61 6e 2e 20 54 68 |ely gaus|sian. Th|
|00001050| 69 73 0d 63 6f 64 65 20 | 77 61 73 20 6f 72 69 67 |is.code |was orig|
|00001060| 69 6e 61 6c 6c 79 20 77 | 72 69 74 74 65 6e 20 61 |inally w|ritten a|
|00001070| 73 20 61 20 71 75 69 63 | 6b 20 77 61 79 20 74 6f |s a quic|k way to|
|00001080| 20 6d 61 6b 65 20 61 70 | 70 72 6f 78 69 6d 61 74 | make ap|proximat|
|00001090| 65 6c 79 20 67 61 75 73 | 73 69 61 6e 20 6e 6f 69 |ely gaus|sian noi|
|000010a0| 73 65 2e 0d 48 6f 77 65 | 76 65 72 2c 20 6b 42 69 |se..Howe|ver, kBi|
|000010b0| 6e 6f 6d 69 61 6c 50 64 | 66 20 69 73 20 70 72 6f |nomialPd|f is pro|
|000010c0| 62 61 62 6c 79 20 6d 75 | 63 68 20 73 6c 6f 77 65 |bably mu|ch slowe|
|000010d0| 72 20 74 68 61 6e 20 74 | 68 65 20 73 75 62 73 65 |r than t|he subse|
|000010e0| 71 75 65 6e 74 6c 79 20 | 77 72 69 74 74 65 6e 0d |quently |written.|
|000010f0| 6b 47 61 75 73 73 69 61 | 6e 50 64 66 2c 20 77 68 |kGaussia|nPdf, wh|
|00001100| 69 63 68 20 70 72 6f 76 | 69 64 65 73 20 73 61 6d |ich prov|ides sam|
|00001110| 70 6c 65 73 20 74 68 61 | 74 20 61 72 65 20 61 63 |ples tha|t are ac|
|00001120| 63 75 72 61 74 65 6c 79 | 20 67 61 75 73 73 69 61 |curately| gaussia|
|00001130| 6e 2e 0d 0d 76 6f 69 64 | 20 47 65 74 47 6f 6f 64 |n...void| GetGood|
|00001140| 4e 6f 69 73 65 50 64 66 | 42 6f 75 6e 64 73 28 70 |NoisePdf|Bounds(p|
|00001150| 64 66 4b 69 6e 64 2c 6d | 65 61 6e 2c 63 6c 69 70 |dfKind,m|ean,clip|
|00001160| 70 65 64 53 64 2c 26 75 | 6e 63 6c 69 70 70 65 64 |pedSd,&u|nclipped|
|00001170| 53 64 2c 26 6d 69 6e 2c | 26 6d 61 78 29 3b 0d 0d |Sd,&min,|&max);..|
|00001180| 47 65 74 47 6f 6f 64 4e | 6f 69 73 65 50 64 66 42 |GetGoodN|oisePdfB|
|00001190| 6f 75 6e 64 73 20 69 73 | 20 61 20 75 74 69 6c 69 |ounds is| a utili|
|000011a0| 74 79 20 72 6f 75 74 69 | 6e 65 20 74 68 61 74 20 |ty routi|ne that |
|000011b0| 68 65 6c 70 73 20 79 6f | 75 20 63 68 6f 6f 73 65 |helps yo|u choose|
|000011c0| 20 67 6f 6f 64 20 70 61 | 72 61 6d 65 74 65 72 73 | good pa|rameters|
|000011d0| 0d 77 69 74 68 20 77 68 | 69 63 68 20 74 6f 20 63 |.with wh|ich to c|
|000011e0| 61 6c 6c 20 4e 6f 69 73 | 65 50 64 66 46 69 6c 6c |all Nois|ePdfFill|
|000011f0| 20 6f 72 20 4e 6f 69 73 | 65 50 64 66 41 64 64 2e | or Nois|ePdfAdd.|
|00001200| 20 42 65 20 61 77 61 72 | 65 20 74 68 61 74 2c 20 | Be awar|e that, |
|00001210| 77 68 65 72 65 61 73 0d | 4e 6f 69 73 65 50 64 66 |whereas.|NoisePdf|
|00001220| 46 69 6c 6c 20 61 6e 64 | 20 4e 6f 69 73 65 50 64 |Fill and| NoisePd|
|00001230| 66 41 64 64 20 61 72 65 | 20 67 65 6e 65 72 61 6c |fAdd are| general|
|00001240| 2d 70 75 72 70 6f 73 65 | 2c 20 74 68 65 20 22 67 |-purpose|, the "g|
|00001250| 6f 6f 64 22 20 69 6e 20 | 74 68 65 20 6e 61 6d 65 |ood" in |the name|
|00001260| 0d 22 47 65 74 47 6f 6f | 64 4e 6f 69 73 65 50 64 |."GetGoo|dNoisePd|
|00001270| 66 42 6f 75 6e 64 73 22 | 20 69 6e 64 69 63 61 74 |fBounds"| indicat|
|00001280| 65 73 20 74 68 61 74 20 | 69 74 73 20 72 65 63 6f |es that |its reco|
|00001290| 6d 6d 65 6e 64 61 74 69 | 6f 6e 73 20 61 72 65 20 |mmendati|ons are |
|000012a0| 6e 6f 74 20 6e 65 63 65 | 73 73 61 72 69 6c 79 0d |not nece|ssarily.|
|000012b0| 62 65 73 74 2e 20 49 74 | 20 69 6e 63 6f 72 70 6f |best. It| incorpo|
|000012c0| 72 61 74 65 73 20 73 65 | 76 65 72 61 6c 20 72 65 |rates se|veral re|
|000012d0| 61 73 6f 6e 61 62 6c 65 | 20 62 75 74 20 73 6f 6d |asonable| but som|
|000012e0| 65 77 68 61 74 20 61 72 | 62 69 74 72 61 72 79 20 |ewhat ar|bitrary |
|000012f0| 61 73 73 75 6d 70 74 69 | 6f 6e 73 2c 20 65 2e 67 |assumpti|ons, e.g|
|00001300| 2e 0d 74 68 61 74 20 79 | 6f 75 27 64 20 6c 69 6b |..that y|ou'd lik|
|00001310| 65 20 74 6f 20 63 6c 69 | 70 20 79 6f 75 72 20 67 |e to cli|p your g|
|00001320| 61 75 73 73 69 61 6e 20 | 61 74 20 b1 32 20 73 64 |aussian |at .2 sd|
|00001330| 2c 20 61 6e 64 20 68 65 | 6c 70 73 20 79 6f 75 20 |, and he|lps you |
|00001340| 74 6f 20 63 68 6f 6f 73 | 65 20 61 20 67 6f 6f 64 |to choos|e a good|
|00001350| 0d 73 65 74 20 6f 66 20 | 70 61 72 61 6d 65 74 65 |.set of |paramete|
|00001360| 72 73 20 74 6f 20 6f 62 | 74 61 69 6e 20 74 68 61 |rs to ob|tain tha|
|00001370| 74 20 72 65 73 75 6c 74 | 2e 20 47 65 74 47 6f 6f |t result|. GetGoo|
|00001380| 64 4e 6f 69 73 65 50 64 | 66 42 6f 75 6e 64 73 20 |dNoisePd|fBounds |
|00001390| 77 69 6c 6c 20 6e 6f 74 | 20 62 65 0d 61 70 70 72 |will not| be.appr|
|000013a0| 6f 70 72 69 61 74 65 20 | 74 6f 20 61 6c 6c 20 75 |opriate |to all u|
|000013b0| 73 65 73 20 6f 66 20 4e | 6f 69 73 65 50 64 66 46 |ses of N|oisePdfF|
|000013c0| 69 6c 6c 20 61 6e 64 20 | 4e 6f 69 73 65 50 64 66 |ill and |NoisePdf|
|000013d0| 41 64 64 3b 20 79 6f 75 | 20 6d 61 79 20 77 61 6e |Add; you| may wan|
|000013e0| 74 20 74 6f 20 77 72 69 | 74 65 0d 79 6f 75 72 20 |t to wri|te.your |
|000013f0| 6f 77 6e 2e 20 4e 6f 74 | 65 3a 20 47 65 74 47 6f |own. Not|e: GetGo|
|00001400| 6f 64 4e 6f 69 73 65 50 | 64 66 42 6f 75 6e 64 73 |odNoiseP|dfBounds|
|00001410| 20 69 73 20 73 74 69 6c | 6c 20 75 6e 64 65 72 20 | is stil|l under |
|00001420| 64 65 76 65 6c 6f 70 6d | 65 6e 74 3b 20 49 20 68 |developm|ent; I h|
|00001430| 61 76 65 6e 27 74 20 79 | 65 74 0d 61 64 64 65 64 |aven't y|et.added|
|00001440| 20 69 74 73 20 70 72 6f | 74 6f 74 79 70 65 20 74 | its pro|totype t|
|00001450| 6f 20 56 69 64 65 6f 54 | 6f 6f 6c 62 6f 78 2e 68 |o VideoT|oolbox.h|
|00001460| 2e 20 42 65 77 61 72 65 | 20 74 68 61 74 20 69 66 |. Beware| that if|
|00001470| 20 74 68 65 20 b1 32 2a | 73 64 20 62 6f 75 6e 64 | the .2*|sd bound|
|00001480| 73 20 61 72 65 20 0d 63 | 6c 69 70 70 65 64 20 62 |s are .c|lipped b|
|00001490| 79 20 74 68 65 20 73 75 | 70 70 6c 69 65 64 20 6d |y the su|pplied m|
|000014a0| 69 6e 2c 6d 61 78 20 62 | 6f 75 6e 64 73 20 74 68 |in,max b|ounds th|
|000014b0| 65 6e 20 74 68 65 20 72 | 65 74 75 72 6e 65 64 20 |en the r|eturned |
|000014c0| 75 6e 63 6c 69 70 70 65 | 64 53 64 20 77 69 6c 6c |unclippe|dSd will|
|000014d0| 20 0d 62 65 20 77 72 6f | 6e 67 2e 20 49 20 77 61 | .be wro|ng. I wa|
|000014e0| 6e 74 65 64 20 74 6f 20 | 61 64 64 20 63 6f 64 65 |nted to |add code|
|000014f0| 20 74 6f 20 63 6f 6d 70 | 75 74 65 20 74 68 65 20 | to comp|ute the |
|00001500| 65 78 61 63 74 20 61 6e | 73 77 65 72 2c 20 77 68 |exact an|swer, wh|
|00001510| 65 6e 20 69 74 20 65 78 | 69 73 74 73 2c 20 0d 62 |en it ex|ists, .b|
|00001520| 75 74 20 74 68 65 20 69 | 6e 74 65 67 72 61 6c 73 |ut the i|ntegrals|
|00001530| 20 66 6f 72 20 74 68 65 | 20 67 61 75 73 73 69 61 | for the| gaussia|
|00001540| 6e 20 63 61 73 65 20 77 | 65 72 65 20 73 75 66 66 |n case w|ere suff|
|00001550| 69 63 69 65 6e 74 6c 79 | 20 64 69 66 66 69 63 75 |iciently| difficu|
|00001560| 6c 74 20 74 68 61 74 20 | 49 20 0d 70 75 74 20 69 |lt that |I .put i|
|00001570| 74 20 61 73 69 64 65 20 | 66 6f 72 20 73 6f 6d 65 |t aside |for some|
|00001580| 20 66 75 74 75 72 65 20 | 64 61 74 65 2e 0d 0d 54 | future |date...T|
|00001590| 68 65 20 68 61 72 64 65 | 73 74 20 70 61 72 74 20 |he harde|st part |
|000015a0| 6f 66 20 77 72 69 74 69 | 6e 67 20 74 68 65 20 63 |of writi|ng the c|
|000015b0| 6f 64 65 20 69 6e 20 74 | 68 69 73 20 66 69 6c 65 |ode in t|his file|
|000015c0| 20 77 61 73 20 66 69 67 | 75 72 69 6e 67 20 6f 75 | was fig|uring ou|
|000015d0| 74 20 68 6f 77 20 74 6f | 0d 73 65 70 61 72 61 74 |t how to|.separat|
|000015e0| 65 20 74 68 65 20 67 65 | 6e 65 72 61 6c 2d 70 75 |e the ge|neral-pu|
|000015f0| 72 70 6f 73 65 20 63 6f | 64 65 20 28 69 2e 65 2e |rpose co|de (i.e.|
|00001600| 20 4e 6f 69 73 65 50 64 | 66 46 69 6c 6c 29 20 66 | NoisePd|fFill) f|
|00001610| 72 6f 6d 20 74 68 65 20 | 70 72 61 67 6d 61 74 69 |rom the |pragmati|
|00001620| 63 20 62 75 74 0d 73 6f | 6d 65 77 68 61 74 20 61 |c but.so|mewhat a|
|00001630| 72 62 69 74 72 61 72 79 | 20 61 73 73 75 6d 70 74 |rbitrary| assumpt|
|00001640| 69 6f 6e 73 20 6e 6f 77 | 20 65 6e 63 61 70 73 75 |ions now| encapsu|
|00001650| 6c 61 74 65 64 20 69 6e | 20 47 65 74 47 6f 6f 64 |lated in| GetGood|
|00001660| 4e 6f 69 73 65 50 64 66 | 42 6f 75 6e 64 73 2e 0d |NoisePdf|Bounds..|
|00001670| 0d 48 49 53 54 4f 52 59 | 3a 0d 33 2f 32 30 2f 39 |.HISTORY|:.3/20/9|
|00001680| 35 20 64 67 70 20 77 72 | 6f 74 65 20 69 74 2c 20 |5 dgp wr|ote it, |
|00001690| 62 61 73 65 64 20 6f 6e | 20 6d 79 20 4d 61 6b 65 |based on| my Make|
|000016a0| 54 65 78 74 49 6e 4e 6f | 69 73 65 57 6f 72 6c 64 |TextInNo|iseWorld|
|000016b0| 2e 63 0d 34 2f 38 2f 39 | 35 20 64 67 70 20 72 65 |.c.4/8/9|5 dgp re|
|000016c0| 6d 6f 76 65 64 20 61 6e | 79 20 61 73 73 75 6d 70 |moved an|y assump|
|000016d0| 74 69 6f 6e 20 74 68 61 | 74 20 77 6f 72 6c 64 20 |tion tha|t world |
|000016e0| 69 73 20 61 20 47 57 6f | 72 6c 64 50 74 72 3b 20 |is a GWo|rldPtr; |
|000016f0| 69 74 20 63 61 6e 20 61 | 6c 73 6f 0d 62 65 20 61 |it can a|lso.be a|
|00001700| 20 43 57 69 6e 64 6f 77 | 50 74 72 20 6f 72 20 61 | CWindow|Ptr or a|
|00001710| 20 57 69 6e 64 6f 77 50 | 74 72 2e 0d 34 2f 31 38 | WindowP|tr..4/18|
|00001720| 2f 39 35 20 64 67 70 20 | 66 69 78 65 64 20 65 72 |/95 dgp |fixed er|
|00001730| 72 6f 72 20 69 6e 20 4e | 6f 69 73 65 50 64 66 41 |ror in N|oisePdfA|
|00001740| 64 64 3a 20 6d 65 61 6e | 20 26 20 73 64 20 77 65 |dd: mean| & sd we|
|00001750| 72 65 20 73 77 61 70 70 | 65 64 2e 0d 2a 2f 0d 0d |re swapp|ed..*/..|
|00001760| 23 69 6e 63 6c 75 64 65 | 20 22 56 69 64 65 6f 54 |#include| "VideoT|
|00001770| 6f 6f 6c 62 6f 78 2e 68 | 22 0d 4f 53 45 72 72 20 |oolbox.h|".OSErr |
|00001780| 4e 6f 69 73 65 50 64 66 | 46 69 6c 6c 28 47 57 6f |NoisePdf|Fill(GWo|
|00001790| 72 6c 64 50 74 72 20 77 | 6f 72 6c 64 2c 52 65 63 |rldPtr w|orld,Rec|
|000017a0| 74 20 2a 72 65 63 74 50 | 74 72 0d 09 2c 69 6e 74 |t *rectP|tr..,int|
|000017b0| 20 70 64 66 4b 69 6e 64 | 2c 64 6f 75 62 6c 65 20 | pdfKind|,double |
|000017c0| 2a 6d 65 61 6e 50 74 72 | 2c 64 6f 75 62 6c 65 20 |*meanPtr|,double |
|000017d0| 2a 73 64 50 74 72 2c 69 | 6e 74 20 6d 69 6e 2c 69 |*sdPtr,i|nt min,i|
|000017e0| 6e 74 20 6d 61 78 29 3b | 0d 4f 53 45 72 72 20 4e |nt max);|.OSErr N|
|000017f0| 6f 69 73 65 50 64 66 41 | 64 64 28 47 57 6f 72 6c |oisePdfA|dd(GWorl|
|00001800| 64 50 74 72 20 77 6f 72 | 6c 64 2c 52 65 63 74 20 |dPtr wor|ld,Rect |
|00001810| 2a 72 65 63 74 50 74 72 | 0d 09 2c 69 6e 74 20 70 |*rectPtr|..,int p|
|00001820| 64 66 4b 69 6e 64 2c 64 | 6f 75 62 6c 65 20 2a 6d |dfKind,d|ouble *m|
|00001830| 65 61 6e 50 74 72 2c 64 | 6f 75 62 6c 65 20 2a 73 |eanPtr,d|ouble *s|
|00001840| 64 50 74 72 2c 69 6e 74 | 20 6d 69 6e 2c 69 6e 74 |dPtr,int| min,int|
|00001850| 20 6d 61 78 29 3b 0d 76 | 6f 69 64 20 47 65 74 47 | max);.v|oid GetG|
|00001860| 6f 6f 64 4e 6f 69 73 65 | 50 64 66 42 6f 75 6e 64 |oodNoise|PdfBound|
|00001870| 73 28 69 6e 74 20 70 64 | 66 4b 69 6e 64 2c 64 6f |s(int pd|fKind,do|
|00001880| 75 62 6c 65 20 6d 65 61 | 6e 2c 64 6f 75 62 6c 65 |uble mea|n,double|
|00001890| 20 63 6c 69 70 70 65 64 | 53 64 0d 09 2c 64 6f 75 | clipped|Sd..,dou|
|000018a0| 62 6c 65 20 2a 75 6e 63 | 6c 69 70 70 65 64 53 64 |ble *unc|lippedSd|
|000018b0| 50 74 72 2c 69 6e 74 20 | 2a 6d 69 6e 50 74 72 2c |Ptr,int |*minPtr,|
|000018c0| 69 6e 74 20 2a 6d 61 78 | 50 74 72 29 3b 0d 0d 2f |int *max|Ptr);../|
|000018d0| 2f 65 6e 75 6d 7b 6b 42 | 69 6e 61 72 79 50 64 66 |/enum{kB|inaryPdf|
|000018e0| 3d 30 2c 6b 42 69 6e 6f | 6d 69 61 6c 50 64 66 2c |=0,kBino|mialPdf,|
|000018f0| 6b 47 61 75 73 73 69 61 | 6e 50 64 66 2c 6b 55 6e |kGaussia|nPdf,kUn|
|00001900| 69 66 6f 72 6d 50 64 66 | 7d 3b 20 2f 2f 20 69 6e |iformPdf|}; // in|
|00001910| 20 56 69 64 65 6f 54 6f | 6f 6c 62 6f 78 2e 68 0d | VideoTo|olbox.h.|
|00001920| 0d 23 75 6e 64 65 66 20 | 4d 41 58 0d 23 75 6e 64 |.#undef |MAX.#und|
|00001930| 65 66 20 4d 49 4e 0d 23 | 64 65 66 69 6e 65 20 4d |ef MIN.#|define M|
|00001940| 41 58 28 61 2c 62 29 20 | 28 28 61 29 20 3e 20 28 |AX(a,b) |((a) > (|
|00001950| 62 29 20 3f 20 28 61 29 | 20 3a 20 28 62 29 29 0d |b) ? (a)| : (b)).|
|00001960| 23 64 65 66 69 6e 65 20 | 4d 49 4e 28 61 2c 62 29 |#define |MIN(a,b)|
|00001970| 20 28 28 61 29 20 3c 20 | 28 62 29 20 3f 20 28 61 | ((a) < |(b) ? (a|
|00001980| 29 20 3a 20 28 62 29 29 | 0d 73 74 61 74 69 63 20 |) : (b))|.static |
|00001990| 42 6f 6f 6c 65 61 6e 20 | 64 69 61 67 6e 6f 73 74 |Boolean |diagnost|
|000019a0| 69 63 73 3d 30 3b 0d 0d | 4f 53 45 72 72 20 4e 6f |ics=0;..|OSErr No|
|000019b0| 69 73 65 50 64 66 46 69 | 6c 6c 28 47 57 6f 72 6c |isePdfFi|ll(GWorl|
|000019c0| 64 50 74 72 20 77 6f 72 | 6c 64 2c 52 65 63 74 20 |dPtr wor|ld,Rect |
|000019d0| 2a 72 65 63 74 50 74 72 | 0d 09 2c 69 6e 74 20 70 |*rectPtr|..,int p|
|000019e0| 64 66 4b 69 6e 64 2c 64 | 6f 75 62 6c 65 20 2a 6d |dfKind,d|ouble *m|
|000019f0| 65 61 6e 50 74 72 2c 64 | 6f 75 62 6c 65 20 2a 73 |eanPtr,d|ouble *s|
|00001a00| 64 50 74 72 2c 69 6e 74 | 20 6d 69 6e 2c 69 6e 74 |dPtr,int| min,int|
|00001a10| 20 6d 61 78 29 0d 7b 0d | 09 43 47 72 61 66 50 74 | max).{.|.CGrafPt|
|00001a20| 72 20 6f 6c 64 50 6f 72 | 74 3b 0d 09 47 44 48 61 |r oldPor|t;..GDHa|
|00001a30| 6e 64 6c 65 20 6f 6c 64 | 44 65 76 69 63 65 3b 0d |ndle old|Device;.|
|00001a40| 20 20 20 20 69 6e 74 20 | 65 72 72 6f 72 3d 30 3b | int |error=0;|
|00001a50| 0d 09 4f 53 45 72 72 20 | 6f 73 45 72 72 3d 30 3b |..OSErr |osErr=0;|
|00001a60| 0d 09 6c 6f 6e 67 20 6e | 3b 0d 09 69 6e 74 20 69 |..long n|;..int i|
|00001a70| 2c 6a 2c 78 2c 79 3b 0d | 09 6c 6f 6e 67 20 6c 6f |,j,x,y;.|.long lo|
|00001a80| 77 2c 68 69 67 68 2c 73 | 61 6d 70 6c 65 3b 0d 20 |w,high,s|ample;. |
|00001a90| 20 20 20 64 6f 75 62 6c | 65 20 61 63 74 75 61 6c | doubl|e actual|
|00001aa0| 4d 65 61 6e 2c 61 63 74 | 75 61 6c 53 64 3b 09 2f |Mean,act|ualSd;./|
|00001ab0| 2f 20 6d 65 61 6e 20 61 | 6e 64 20 73 64 20 6f 66 |/ mean a|nd sd of|
|00001ac0| 20 70 72 6f 63 65 73 73 | 20 74 68 61 74 20 67 65 | process| that ge|
|00001ad0| 6e 65 72 61 74 65 64 20 | 74 68 65 20 69 6d 61 67 |nerated |the imag|
|00001ae0| 65 0d 09 6c 6f 6e 67 20 | 61 63 74 75 61 6c 4d 69 |e..long |actualMi|
|00001af0| 6e 2c 61 63 74 75 61 6c | 4d 61 78 3b 0d 09 69 6e |n,actual|Max;..in|
|00001b00| 74 20 62 69 6e 6f 6d 69 | 61 6c 53 61 6d 70 6c 65 |t binomi|alSample|
|00001b10| 73 3b 0d 09 64 6f 75 62 | 6c 65 20 62 69 6e 6f 6d |s;..doub|le binom|
|00001b20| 69 61 6c 46 61 63 74 6f | 72 3b 0d 09 6c 6f 6e 67 |ialFacto|r;..long|
|00001b30| 20 65 78 74 72 61 53 61 | 6d 70 6c 65 73 3b 0d 09 | extraSa|mples;..|
|00001b40| 73 68 6f 72 74 20 2a 64 | 69 73 74 72 69 62 75 74 |short *d|istribut|
|00001b50| 69 6f 6e 3b 0d 09 73 74 | 61 74 69 63 20 73 68 6f |ion;..st|atic sho|
|00001b60| 72 74 20 2a 2a 64 69 73 | 74 72 69 62 75 74 69 6f |rt **dis|tributio|
|00001b70| 6e 48 61 6e 64 6c 65 3d | 4e 55 4c 4c 3b 0d 09 73 |nHandle=|NULL;..s|
|00001b80| 74 61 74 69 63 20 6c 6f | 6e 67 20 64 69 73 74 72 |tatic lo|ng distr|
|00001b90| 69 62 75 74 69 6f 6e 53 | 69 7a 65 3b 0d 09 73 74 |ibutionS|ize;..st|
|00001ba0| 61 74 69 63 20 64 6f 75 | 62 6c 65 20 6c 6f 77 53 |atic dou|ble lowS|
|00001bb0| 61 76 65 2c 68 69 67 68 | 53 61 76 65 2c 6d 65 61 |ave,high|Save,mea|
|00001bc0| 6e 53 61 76 65 2c 75 6e | 63 6c 69 70 70 65 64 53 |nSave,un|clippedS|
|00001bd0| 64 53 61 76 65 2c 61 63 | 74 75 61 6c 53 64 53 61 |dSave,ac|tualSdSa|
|00001be0| 76 65 3b 0d 09 64 6f 75 | 62 6c 65 20 6d 65 61 6e |ve;..dou|ble mean|
|00001bf0| 53 71 75 61 72 65 2c 61 | 2c 61 61 3b 0d 09 52 47 |Square,a|,aa;..RG|
|00001c00| 42 43 6f 6c 6f 72 20 72 | 67 62 3b 0d 09 47 44 48 |BColor r|gb;..GDH|
|00001c10| 61 6e 64 6c 65 20 64 65 | 76 69 63 65 3b 0d 09 69 |andle de|vice;..i|
|00001c20| 6e 74 20 70 69 78 65 6c | 53 69 7a 65 3b 0d 20 20 |nt pixel|Size;. |
|00001c30| 20 20 73 74 61 74 69 63 | 20 63 6f 6e 73 74 20 52 | static| const R|
|00001c40| 47 42 43 6f 6c 6f 72 20 | 62 6c 61 63 6b 52 47 42 |GBColor |blackRGB|
|00001c50| 3d 7b 30 2c 30 2c 30 7d | 2c 77 68 69 74 65 52 47 |={0,0,0}|,whiteRG|
|00001c60| 42 3d 7b 30 78 46 46 46 | 46 2c 30 78 46 46 46 46 |B={0xFFF|F,0xFFFF|
|00001c70| 2c 30 78 46 46 46 46 7d | 3b 0d 09 75 6e 73 69 67 |,0xFFFF}|;..unsig|
|00001c80| 6e 65 64 20 6c 6f 6e 67 | 20 70 69 78 5b 32 30 34 |ned long| pix[204|
|00001c90| 38 5d 3b 0d 09 72 65 67 | 69 73 74 65 72 20 6c 6f |8];..reg|ister lo|
|00001ca0| 6e 67 20 2a 70 4c 3b 0d | 09 0d 09 2f 2f 20 4d 61 |ng *pL;.|...// Ma|
|00001cb0| 6b 65 20 6e 6f 69 73 65 | 2e 20 54 61 6b 65 73 20 |ke noise|. Takes |
|00001cc0| 33 30 30 20 6d 73 0d 09 | 61 73 73 65 72 74 28 53 |300 ms..|assert(S|
|00001cd0| 74 61 63 6b 53 70 61 63 | 65 28 29 3e 34 30 30 30 |tackSpac|e()>4000|
|00001ce0| 29 3b 0d 09 61 73 73 65 | 72 74 28 77 6f 72 6c 64 |);..asse|rt(world|
|00001cf0| 21 3d 4e 55 4c 4c 20 26 | 26 20 73 64 50 74 72 21 |!=NULL &|& sdPtr!|
|00001d00| 3d 4e 55 4c 4c 20 26 26 | 20 6d 65 61 6e 50 74 72 |=NULL &&| meanPtr|
|00001d10| 21 3d 4e 55 4c 4c 29 3b | 0d 09 61 73 73 65 72 74 |!=NULL);|..assert|
|00001d20| 28 21 49 73 4e 61 6e 28 | 2a 6d 65 61 6e 50 74 72 |(!IsNan(|*meanPtr|
|00001d30| 29 20 26 26 20 21 49 73 | 4e 61 6e 28 2a 73 64 50 |) && !Is|Nan(*sdP|
|00001d40| 74 72 29 29 3b 0d 09 61 | 73 73 65 72 74 28 2a 73 |tr));..a|ssert(*s|
|00001d50| 64 50 74 72 3e 3d 30 2e | 30 29 3b 0d 09 61 73 73 |dPtr>=0.|0);..ass|
|00001d60| 65 72 74 28 6d 69 6e 3c | 3d 2a 6d 65 61 6e 50 74 |ert(min<|=*meanPt|
|00001d70| 72 20 26 26 20 2a 6d 65 | 61 6e 50 74 72 3c 3d 6d |r && *me|anPtr<=m|
|00001d80| 61 78 29 3b 0d 09 68 69 | 67 68 3d 6d 61 78 3b 0d |ax);..hi|gh=max;.|
|00001d90| 09 6c 6f 77 3d 6d 69 6e | 3b 0d 09 69 66 28 49 73 |.low=min|;..if(Is|
|00001da0| 49 6e 66 28 2a 73 64 50 | 74 72 29 20 26 26 20 70 |Inf(*sdP|tr) && p|
|00001db0| 64 66 4b 69 6e 64 21 3d | 6b 42 69 6e 61 72 79 50 |dfKind!=|kBinaryP|
|00001dc0| 64 66 29 70 64 66 4b 69 | 6e 64 3d 6b 55 6e 69 66 |df)pdfKi|nd=kUnif|
|00001dd0| 6f 72 6d 50 64 66 3b 0d | 09 73 77 69 74 63 68 28 |ormPdf;.|.switch(|
|00001de0| 70 64 66 4b 69 6e 64 29 | 7b 0d 09 63 61 73 65 20 |pdfKind)|{..case |
|00001df0| 6b 42 69 6e 61 72 79 50 | 64 66 3a 0d 09 09 2f 2f |kBinaryP|df:...//|
|00001e00| 20 68 69 67 68 20 61 6e | 64 20 6c 6f 77 20 61 72 | high an|d low ar|
|00001e10| 65 20 76 61 6c 75 65 73 | 20 63 6f 72 72 65 73 70 |e values| corresp|
|00001e20| 6f 6e 64 69 6e 67 20 74 | 6f 20 68 65 61 64 73 20 |onding t|o heads |
|00001e30| 61 6e 64 20 74 61 69 6c | 73 2e 0d 09 09 2f 2f 20 |and tail|s....// |
|00001e40| 54 68 65 20 68 69 67 68 | 2d 6c 6f 77 20 64 69 66 |The high|-low dif|
|00001e50| 66 65 72 65 6e 63 65 20 | 69 73 20 6d 6f 72 65 20 |ference |is more |
|00001e60| 69 6d 70 6f 72 74 61 6e | 74 20 74 68 61 6e 20 74 |importan|t than t|
|00001e70| 68 65 69 72 20 69 6e 64 | 69 76 69 64 75 61 6c 20 |heir ind|ividual |
|00001e80| 76 61 6c 75 65 73 2e 0d | 09 09 69 66 28 21 49 73 |values..|..if(!Is|
|00001e90| 49 6e 66 28 2a 73 64 50 | 74 72 29 29 7b 0d 09 09 |Inf(*sdP|tr)){...|
|00001ea0| 09 61 3d 32 2a 28 2a 73 | 64 50 74 72 29 3b 0d 09 |.a=2*(*s|dPtr);..|
|00001eb0| 09 09 6c 6f 77 3d 4d 41 | 58 28 72 6f 75 6e 64 28 |..low=MA|X(round(|
|00001ec0| 2a 6d 65 61 6e 50 74 72 | 2d 61 2f 32 29 2c 6d 69 |*meanPtr|-a/2),mi|
|00001ed0| 6e 29 3b 0d 09 09 09 68 | 69 67 68 3d 4d 49 4e 28 |n);....h|igh=MIN(|
|00001ee0| 72 6f 75 6e 64 28 6c 6f | 77 2b 61 29 2c 6d 61 78 |round(lo|w+a),max|
|00001ef0| 29 3b 0d 09 09 09 6c 6f | 77 3d 4d 41 58 28 72 6f |);....lo|w=MAX(ro|
|00001f00| 75 6e 64 28 68 69 67 68 | 2d 61 29 2c 6d 69 6e 29 |und(high|-a),min)|
|00001f10| 3b 0d 09 09 09 69 66 28 | 6c 6f 77 3d 3d 68 69 67 |;....if(|low==hig|
|00001f20| 68 20 26 26 20 2a 73 64 | 50 74 72 3e 30 29 7b 0d |h && *sd|Ptr>0){.|
|00001f30| 09 09 09 09 69 66 28 68 | 69 67 68 3c 6d 61 78 29 |....if(h|igh<max)|
|00001f40| 68 69 67 68 2b 2b 3b 0d | 09 09 09 09 65 6c 73 65 |high++;.|....else|
|00001f50| 20 69 66 28 6c 6f 77 3e | 6d 69 6e 29 6c 6f 77 2d | if(low>|min)low-|
|00001f60| 2d 3b 0d 09 09 09 7d 0d | 09 09 7d 0d 09 09 62 72 |-;....}.|..}...br|
|00001f70| 65 61 6b 3b 0d 09 63 61 | 73 65 20 6b 55 6e 69 66 |eak;..ca|se kUnif|
|00001f80| 6f 72 6d 50 64 66 3a 0d | 09 09 69 66 28 21 49 73 |ormPdf:.|..if(!Is|
|00001f90| 49 6e 66 28 2a 73 64 50 | 74 72 29 29 7b 0d 09 09 |Inf(*sdP|tr)){...|
|00001fa0| 09 61 3d 32 2a 73 71 72 | 74 28 33 29 2a 28 2a 73 |.a=2*sqr|t(3)*(*s|
|00001fb0| 64 50 74 72 29 2d 31 3b | 09 2f 2f 20 69 6e 74 65 |dPtr)-1;|.// inte|
|00001fc0| 67 65 72 20 72 61 6e 67 | 65 20 6f 66 20 70 64 66 |ger rang|e of pdf|
|00001fd0| 20 66 6f 72 20 73 70 65 | 63 69 66 69 65 64 20 73 | for spe|cified s|
|00001fe0| 64 0d 09 09 09 6c 6f 77 | 3d 4d 41 58 28 72 6f 75 |d....low|=MAX(rou|
|00001ff0| 6e 64 28 2a 6d 65 61 6e | 50 74 72 2d 61 2f 32 29 |nd(*mean|Ptr-a/2)|
|00002000| 2c 6d 69 6e 29 3b 0d 09 | 09 09 68 69 67 68 3d 4d |,min);..|..high=M|
|00002010| 49 4e 28 72 6f 75 6e 64 | 28 6c 6f 77 2b 61 29 2c |IN(round|(low+a),|
|00002020| 6d 61 78 29 3b 0d 09 09 | 09 6c 6f 77 3d 4d 41 58 |max);...|.low=MAX|
|00002030| 28 72 6f 75 6e 64 28 68 | 69 67 68 2d 61 29 2c 6d |(round(h|igh-a),m|
|00002040| 69 6e 29 3b 0d 09 09 09 | 69 66 28 6c 6f 77 3d 3d |in);....|if(low==|
|00002050| 68 69 67 68 20 26 26 20 | 2a 73 64 50 74 72 3e 30 |high && |*sdPtr>0|
|00002060| 29 7b 0d 09 09 09 09 69 | 66 28 68 69 67 68 3c 6d |){.....i|f(high<m|
|00002070| 61 78 29 68 69 67 68 2b | 2b 3b 0d 09 09 09 09 65 |ax)high+|+;.....e|
|00002080| 6c 73 65 20 69 66 28 6c | 6f 77 3e 6d 69 6e 29 6c |lse if(l|ow>min)l|
|00002090| 6f 77 2d 2d 3b 0d 09 09 | 09 7d 0d 09 09 7d 0d 09 |ow--;...|.}...}..|
|000020a0| 09 62 72 65 61 6b 3b 0d | 09 64 65 66 61 75 6c 74 |.break;.|.default|
|000020b0| 3a 0d 09 09 62 72 65 61 | 6b 3b 0d 09 7d 0d 09 47 |:...brea|k;..}..G|
|000020c0| 65 74 47 57 6f 72 6c 64 | 28 26 6f 6c 64 50 6f 72 |etGWorld|(&oldPor|
|000020d0| 74 2c 26 6f 6c 64 44 65 | 76 69 63 65 29 3b 0d 09 |t,&oldDe|vice);..|
|000020e0| 64 65 76 69 63 65 3d 47 | 65 74 57 69 6e 64 6f 77 |device=G|etWindow|
|000020f0| 44 65 76 69 63 65 28 28 | 57 69 6e 64 6f 77 50 74 |Device((|WindowPt|
|00002100| 72 29 77 6f 72 6c 64 29 | 3b 0d 09 70 69 78 65 6c |r)world)|;..pixel|
|00002110| 53 69 7a 65 3d 28 2a 2a | 28 2a 2a 64 65 76 69 63 |Size=(**|(**devic|
|00002120| 65 29 2e 67 64 50 4d 61 | 70 29 2e 70 69 78 65 6c |e).gdPMa|p).pixel|
|00002130| 53 69 7a 65 3b 0d 09 69 | 66 28 6c 6f 77 3d 3d 68 |Size;..i|f(low==h|
|00002140| 69 67 68 29 7b 0d 09 09 | 53 65 74 47 57 6f 72 6c |igh){...|SetGWorl|
|00002150| 64 28 77 6f 72 6c 64 2c | 64 65 76 69 63 65 29 3b |d(world,|device);|
|00002160| 0d 09 09 49 6e 64 65 78 | 32 43 6f 6c 6f 72 28 6c |...Index|2Color(l|
|00002170| 6f 77 2c 26 72 67 62 29 | 3b 0d 09 09 52 47 42 42 |ow,&rgb)|;...RGBB|
|00002180| 61 63 6b 43 6f 6c 6f 72 | 28 26 72 67 62 29 3b 0d |ackColor|(&rgb);.|
|00002190| 09 09 45 72 61 73 65 52 | 65 63 74 28 72 65 63 74 |..EraseR|ect(rect|
|000021a0| 50 74 72 29 3b 0d 09 09 | 53 65 74 47 57 6f 72 6c |Ptr);...|SetGWorl|
|000021b0| 64 28 6f 6c 64 50 6f 72 | 74 2c 6f 6c 64 44 65 76 |d(oldPor|t,oldDev|
|000021c0| 69 63 65 29 3b 0d 09 09 | 61 63 74 75 61 6c 4d 65 |ice);...|actualMe|
|000021d0| 61 6e 3d 6c 6f 77 3b 0d | 09 09 61 63 74 75 61 6c |an=low;.|..actual|
|000021e0| 53 64 3d 30 3b 0d 09 09 | 67 6f 74 6f 20 64 6f 6e |Sd=0;...|goto don|
|000021f0| 65 3b 0d 09 7d 0d 09 73 | 77 69 74 63 68 28 70 64 |e;..}..s|witch(pd|
|00002200| 66 4b 69 6e 64 29 7b 0d | 09 63 61 73 65 20 6b 42 |fKind){.|.case kB|
|00002210| 69 6e 61 72 79 50 64 66 | 3a 0d 09 09 53 65 74 47 |inaryPdf|:...SetG|
|00002220| 57 6f 72 6c 64 28 77 6f | 72 6c 64 2c 64 65 76 69 |World(wo|rld,devi|
|00002230| 63 65 29 3b 0d 09 09 49 | 6e 64 65 78 32 43 6f 6c |ce);...I|ndex2Col|
|00002240| 6f 72 28 6c 6f 77 2c 26 | 72 67 62 29 3b 0d 09 09 |or(low,&|rgb);...|
|00002250| 52 47 42 42 61 63 6b 43 | 6f 6c 6f 72 28 26 72 67 |RGBBackC|olor(&rg|
|00002260| 62 29 3b 0d 09 09 49 6e | 64 65 78 32 43 6f 6c 6f |b);...In|dex2Colo|
|00002270| 72 28 68 69 67 68 2c 26 | 72 67 62 29 3b 0d 09 09 |r(high,&|rgb);...|
|00002280| 52 47 42 46 6f 72 65 43 | 6f 6c 6f 72 28 26 72 67 |RGBForeC|olor(&rg|
|00002290| 62 29 3b 0d 09 09 65 72 | 72 6f 72 3d 4e 6f 69 73 |b);...er|ror=Nois|
|000022a0| 65 46 69 6c 6c 28 77 6f | 72 6c 64 2c 72 65 63 74 |eFill(wo|rld,rect|
|000022b0| 50 74 72 2c 31 2c 31 2c | 30 29 3b 20 0d 09 09 52 |Ptr,1,1,|0); ...R|
|000022c0| 47 42 42 61 63 6b 43 6f | 6c 6f 72 28 26 77 68 69 |GBBackCo|lor(&whi|
|000022d0| 74 65 52 47 42 29 3b 0d | 09 09 52 47 42 46 6f 72 |teRGB);.|..RGBFor|
|000022e0| 65 43 6f 6c 6f 72 28 26 | 62 6c 61 63 6b 52 47 42 |eColor(&|blackRGB|
|000022f0| 29 3b 0d 09 09 53 65 74 | 47 57 6f 72 6c 64 28 6f |);...Set|GWorld(o|
|00002300| 6c 64 50 6f 72 74 2c 6f | 6c 64 44 65 76 69 63 65 |ldPort,o|ldDevice|
|00002310| 29 3b 0d 09 09 61 63 74 | 75 61 6c 53 64 3d 30 2e |);...act|ualSd=0.|
|00002320| 35 2a 28 68 69 67 68 2d | 6c 6f 77 29 3b 0d 09 09 |5*(high-|low);...|
|00002330| 61 63 74 75 61 6c 4d 65 | 61 6e 3d 30 2e 35 2a 28 |actualMe|an=0.5*(|
|00002340| 68 69 67 68 2b 6c 6f 77 | 29 3b 0d 09 09 62 72 65 |high+low|);...bre|
|00002350| 61 6b 3b 0d 09 63 61 73 | 65 20 6b 55 6e 69 66 6f |ak;..cas|e kUnifo|
|00002360| 72 6d 50 64 66 3a 0d 09 | 09 6e 3d 31 2b 68 69 67 |rmPdf:..|.n=1+hig|
|00002370| 68 2d 6c 6f 77 3b 0d 09 | 09 61 73 73 65 72 74 28 |h-low;..|.assert(|
|00002380| 72 65 63 74 50 74 72 2d | 3e 72 69 67 68 74 2d 72 |rectPtr-|>right-r|
|00002390| 65 63 74 50 74 72 2d 3e | 6c 65 66 74 3c 3d 73 69 |ectPtr->|left<=si|
|000023a0| 7a 65 6f 66 28 70 69 78 | 29 2f 73 69 7a 65 6f 66 |zeof(pix|)/sizeof|
|000023b0| 28 2a 70 69 78 29 29 3b | 0d 09 09 66 6f 72 28 79 |(*pix));|...for(y|
|000023c0| 3d 72 65 63 74 50 74 72 | 2d 3e 74 6f 70 3b 79 3c |=rectPtr|->top;y<|
|000023d0| 72 65 63 74 50 74 72 2d | 3e 62 6f 74 74 6f 6d 3b |rectPtr-|>bottom;|
|000023e0| 79 2b 2b 29 7b 0d 09 09 | 09 70 4c 3d 28 6c 6f 6e |y++){...|.pL=(lon|
|000023f0| 67 20 2a 29 70 69 78 3b | 0d 09 09 09 66 6f 72 28 |g *)pix;|....for(|
|00002400| 78 3d 72 65 63 74 50 74 | 72 2d 3e 72 69 67 68 74 |x=rectPt|r->right|
|00002410| 2d 72 65 63 74 50 74 72 | 2d 3e 6c 65 66 74 2d 31 |-rectPtr|->left-1|
|00002420| 3b 78 3e 3d 30 3b 78 2d | 2d 29 0d 09 09 09 09 2a |;x>=0;x-|-).....*|
|00002430| 70 4c 2b 2b 3d 6c 6f 77 | 2b 6e 72 61 6e 64 28 6e |pL++=low|+nrand(n|
|00002440| 29 3b 0d 09 09 09 53 65 | 74 57 69 6e 64 6f 77 50 |);....Se|tWindowP|
|00002450| 69 78 65 6c 73 51 75 69 | 63 6b 6c 79 28 28 57 69 |ixelsQui|ckly((Wi|
|00002460| 6e 64 6f 77 50 74 72 29 | 77 6f 72 6c 64 2c 72 65 |ndowPtr)|world,re|
|00002470| 63 74 50 74 72 2d 3e 6c | 65 66 74 2c 79 0d 09 09 |ctPtr->l|eft,y...|
|00002480| 09 09 2c 70 69 78 2c 72 | 65 63 74 50 74 72 2d 3e |..,pix,r|ectPtr->|
|00002490| 72 69 67 68 74 2d 72 65 | 63 74 50 74 72 2d 3e 6c |right-re|ctPtr->l|
|000024a0| 65 66 74 29 3b 0d 09 09 | 7d 0d 09 09 61 73 73 65 |eft);...|}...asse|
|000024b0| 72 74 28 6e 3c 3d 73 69 | 7a 65 6f 66 28 70 69 78 |rt(n<=si|zeof(pix|
|000024c0| 29 2f 73 69 7a 65 6f 66 | 28 2a 70 4c 29 29 3b 0d |)/sizeof|(*pL));.|
|000024d0| 09 09 70 4c 3d 28 6c 6f | 6e 67 20 2a 29 70 69 78 |..pL=(lo|ng *)pix|
|000024e0| 3b 0d 09 09 66 6f 72 28 | 78 3d 6c 6f 77 3b 78 3c |;...for(|x=low;x<|
|000024f0| 3d 68 69 67 68 3b 78 2b | 2b 29 2a 70 4c 2b 2b 3d |=high;x+|+)*pL++=|
|00002500| 78 3b 0d 09 09 61 63 74 | 75 61 6c 4d 65 61 6e 3d |x;...act|ualMean=|
|00002510| 4d 65 61 6e 4c 28 28 6c | 6f 6e 67 20 2a 29 70 69 |MeanL((l|ong *)pi|
|00002520| 78 2c 31 2b 68 69 67 68 | 2d 6c 6f 77 2c 26 61 63 |x,1+high|-low,&ac|
|00002530| 74 75 61 6c 53 64 29 3b | 0d 09 09 69 66 28 64 69 |tualSd);|...if(di|
|00002540| 61 67 6e 6f 73 74 69 63 | 73 29 70 72 69 6e 74 66 |agnostic|s)printf|
|00002550| 28 22 75 6e 63 6c 69 70 | 70 65 64 53 64 20 25 66 |("unclip|pedSd %f|
|00002560| 2c 20 61 63 74 75 61 6c | 53 64 20 25 66 2c 20 61 |, actual|Sd %f, a|
|00002570| 63 74 75 61 6c 53 64 2f | 75 6e 63 6c 69 70 70 65 |ctualSd/|unclippe|
|00002580| 64 53 64 20 25 66 5c 6e | 22 0d 09 09 09 2c 2a 73 |dSd %f\n|"....,*s|
|00002590| 64 50 74 72 2c 61 63 74 | 75 61 6c 53 64 2c 61 63 |dPtr,act|ualSd,ac|
|000025a0| 74 75 61 6c 53 64 2f 28 | 2a 73 64 50 74 72 29 29 |tualSd/(|*sdPtr))|
|000025b0| 3b 0d 09 09 62 72 65 61 | 6b 3b 0d 09 63 61 73 65 |;...brea|k;..case|
|000025c0| 20 6b 47 61 75 73 73 69 | 61 6e 50 64 66 3a 0d 09 | kGaussi|anPdf:..|
|000025d0| 09 2f 2a 0d 09 09 46 69 | 72 73 74 20 77 65 20 6d |./*...Fi|rst we m|
|000025e0| 61 6b 65 20 61 6e 20 6f | 72 64 65 72 65 64 20 6c |ake an o|rdered l|
|000025f0| 69 73 74 20 6f 66 20 61 | 62 6f 75 74 20 74 77 65 |ist of a|bout twe|
|00002600| 6e 74 79 20 74 68 6f 75 | 73 61 6e 64 20 69 6e 74 |nty thou|sand int|
|00002610| 65 67 65 72 73 2c 20 77 | 69 74 68 20 0d 09 09 66 |egers, w|ith ...f|
|00002620| 72 65 71 75 65 6e 63 79 | 20 70 72 6f 70 6f 72 74 |requency| proport|
|00002630| 69 6f 6e 61 6c 20 74 6f | 20 74 68 65 20 64 65 73 |ional to| the des|
|00002640| 69 72 65 64 20 70 72 6f | 62 61 62 69 6c 69 74 79 |ired pro|bability|
|00002650| 2e 20 54 68 69 73 20 74 | 61 62 6c 65 20 6f 6e 6c |. This t|able onl|
|00002660| 79 20 6e 65 65 64 73 0d | 09 09 74 6f 20 62 65 20 |y needs.|..to be |
|00002670| 6d 61 64 65 20 6f 6e 63 | 65 20 61 6e 64 20 63 61 |made onc|e and ca|
|00002680| 6e 20 62 65 20 72 65 75 | 73 65 64 20 69 6e 64 65 |n be reu|sed inde|
|00002690| 66 69 6e 69 74 65 6c 79 | 2c 20 75 6e 74 69 6c 20 |finitely|, until |
|000026a0| 74 68 65 20 70 61 72 61 | 6d 65 74 65 72 73 20 20 |the para|meters |
|000026b0| 0d 09 09 28 6d 65 61 6e | 2c 20 73 64 2c 20 6d 69 |...(mean|, sd, mi|
|000026c0| 6e 2c 20 6d 61 78 29 20 | 6f 66 20 74 68 65 20 64 |n, max) |of the d|
|000026d0| 69 73 74 72 69 62 75 74 | 69 6f 6e 20 63 68 61 6e |istribut|ion chan|
|000026e0| 67 65 2e 20 45 61 63 68 | 20 6e 6f 69 73 65 20 70 |ge. Each| noise p|
|000026f0| 69 78 65 6c 20 69 73 0d | 09 09 61 20 72 61 6e 64 |ixel is.|..a rand|
|00002700| 6f 6d 20 73 61 6d 70 6c | 65 20 66 72 6f 6d 20 74 |om sampl|e from t|
|00002710| 68 65 20 74 61 62 6c 65 | 2e 0d 09 09 2a 2f 0d 09 |he table|....*/..|
|00002720| 09 69 66 28 64 69 73 74 | 72 69 62 75 74 69 6f 6e |.if(dist|ribution|
|00002730| 48 61 6e 64 6c 65 3d 3d | 4e 55 4c 4c 20 7c 7c 20 |Handle==|NULL || |
|00002740| 6c 6f 77 21 3d 6c 6f 77 | 53 61 76 65 20 7c 7c 20 |low!=low|Save || |
|00002750| 68 69 67 68 21 3d 68 69 | 67 68 53 61 76 65 20 0d |high!=hi|ghSave .|
|00002760| 09 09 09 7c 7c 20 49 73 | 49 6e 66 28 2a 73 64 50 |...|| Is|Inf(*sdP|
|00002770| 74 72 29 21 3d 49 73 49 | 6e 66 28 75 6e 63 6c 69 |tr)!=IsI|nf(uncli|
|00002780| 70 70 65 64 53 64 53 61 | 76 65 29 0d 09 09 09 7c |ppedSdSa|ve)....||
|00002790| 7c 20 28 21 49 73 49 6e | 66 28 2a 73 64 50 74 72 || (!IsIn|f(*sdPtr|
|000027a0| 29 20 26 26 20 66 61 62 | 73 28 2a 73 64 50 74 72 |) && fab|s(*sdPtr|
|000027b0| 2f 75 6e 63 6c 69 70 70 | 65 64 53 64 53 61 76 65 |/unclipp|edSdSave|
|000027c0| 2d 31 29 3e 2e 30 31 29 | 0d 09 09 09 7c 7c 20 2a |-1)>.01)|....|| *|
|000027d0| 6d 65 61 6e 50 74 72 21 | 3d 6d 65 61 6e 53 61 76 |meanPtr!|=meanSav|
|000027e0| 65 29 7b 0d 09 09 09 64 | 69 73 74 72 69 62 75 74 |e){....d|istribut|
|000027f0| 69 6f 6e 53 69 7a 65 3d | 32 35 36 2a 31 30 30 4c |ionSize=|256*100L|
|00002800| 3b 0d 09 09 09 69 66 28 | 64 69 73 74 72 69 62 75 |;....if(|distribu|
|00002810| 74 69 6f 6e 48 61 6e 64 | 6c 65 3d 3d 4e 55 4c 4c |tionHand|le==NULL|
|00002820| 29 7b 0d 09 09 09 09 64 | 69 73 74 72 69 62 75 74 |){.....d|istribut|
|00002830| 69 6f 6e 48 61 6e 64 6c | 65 3d 28 73 68 6f 72 74 |ionHandl|e=(short|
|00002840| 20 2a 2a 29 54 65 6d 70 | 4e 65 77 48 61 6e 64 6c | **)Temp|NewHandl|
|00002850| 65 28 64 69 73 74 72 69 | 62 75 74 69 6f 6e 53 69 |e(distri|butionSi|
|00002860| 7a 65 2a 73 69 7a 65 6f | 66 28 2a 64 69 73 74 72 |ze*sizeo|f(*distr|
|00002870| 69 62 75 74 69 6f 6e 29 | 2c 26 6f 73 45 72 72 29 |ibution)|,&osErr)|
|00002880| 3b 0d 09 09 09 09 65 72 | 72 6f 72 3d 6f 73 45 72 |;.....er|ror=osEr|
|00002890| 72 3b 0d 09 09 09 09 69 | 66 28 64 69 73 74 72 69 |r;.....i|f(distri|
|000028a0| 62 75 74 69 6f 6e 48 61 | 6e 64 6c 65 3d 3d 4e 55 |butionHa|ndle==NU|
|000028b0| 4c 4c 29 7b 0d 09 09 09 | 09 09 64 69 73 74 72 69 |LL){....|..distri|
|000028c0| 62 75 74 69 6f 6e 48 61 | 6e 64 6c 65 3d 28 73 68 |butionHa|ndle=(sh|
|000028d0| 6f 72 74 20 2a 2a 29 4e | 65 77 48 61 6e 64 6c 65 |ort **)N|ewHandle|
|000028e0| 28 64 69 73 74 72 69 62 | 75 74 69 6f 6e 53 69 7a |(distrib|utionSiz|
|000028f0| 65 2a 73 69 7a 65 6f 66 | 28 2a 64 69 73 74 72 69 |e*sizeof|(*distri|
|00002900| 62 75 74 69 6f 6e 29 29 | 3b 0d 09 09 09 09 09 65 |bution))|;......e|
|00002910| 72 72 6f 72 3d 4d 65 6d | 45 72 72 6f 72 28 29 3b |rror=Mem|Error();|
|00002920| 0d 09 09 09 09 7d 65 6c | 73 65 20 65 72 72 6f 72 |.....}el|se error|
|00002930| 3d 30 3b 0d 09 09 09 09 | 69 66 28 64 69 73 74 72 |=0;.....|if(distr|
|00002940| 69 62 75 74 69 6f 6e 48 | 61 6e 64 6c 65 3d 3d 4e |ibutionH|andle==N|
|00002950| 55 4c 4c 29 50 72 69 6e | 74 66 45 78 69 74 28 22 |ULL)Prin|tfExit("|
|00002960| 53 6f 72 72 79 2c 20 63 | 6f 75 6c 64 6e 27 74 20 |Sorry, c|ouldn't |
|00002970| 61 6c 6c 6f 63 61 74 65 | 20 25 6c 64 20 62 79 74 |allocate| %ld byt|
|00002980| 65 73 20 22 0d 09 09 09 | 09 09 22 66 6f 72 20 61 |es "....|.."for a|
|00002990| 20 67 61 75 73 73 69 61 | 6e 20 74 61 62 6c 65 2e | gaussia|n table.|
|000029a0| 20 46 69 6c 65 20 d2 25 | 73 d3 20 6c 69 6e 65 20 | File .%|s. line |
|000029b0| 25 64 2e 5c 6e 22 0d 09 | 09 09 09 09 2c 64 69 73 |%d.\n"..|....,dis|
|000029c0| 74 72 69 62 75 74 69 6f | 6e 53 69 7a 65 2a 73 69 |tributio|nSize*si|
|000029d0| 7a 65 6f 66 28 2a 64 69 | 73 74 72 69 62 75 74 69 |zeof(*di|stributi|
|000029e0| 6f 6e 29 2c 5f 5f 46 49 | 4c 45 5f 5f 2c 5f 5f 4c |on),__FI|LE__,__L|
|000029f0| 49 4e 45 5f 5f 29 3b 0d | 09 09 09 7d 0d 09 09 09 |INE__);.|...}....|
|00002a00| 69 66 28 66 61 62 73 28 | 28 68 69 67 68 2d 2a 6d |if(fabs(|(high-*m|
|00002a10| 65 61 6e 50 74 72 29 2d | 28 68 69 67 68 53 61 76 |eanPtr)-|(highSav|
|00002a20| 65 2d 6d 65 61 6e 53 61 | 76 65 29 29 3e 30 2e 35 |e-meanSa|ve))>0.5|
|00002a30| 20 7c 7c 20 68 69 67 68 | 2d 6c 6f 77 21 3d 68 69 | || high|-low!=hi|
|00002a40| 67 68 53 61 76 65 2d 6c | 6f 77 53 61 76 65 20 0d |ghSave-l|owSave .|
|00002a50| 09 09 09 09 7c 7c 20 49 | 73 49 6e 66 28 2a 73 64 |....|| I|sInf(*sd|
|00002a60| 50 74 72 29 21 3d 49 73 | 49 6e 66 28 75 6e 63 6c |Ptr)!=Is|Inf(uncl|
|00002a70| 69 70 70 65 64 53 64 53 | 61 76 65 29 0d 09 09 09 |ippedSdS|ave)....|
|00002a80| 09 7c 7c 20 28 21 49 73 | 49 6e 66 28 2a 73 64 50 |.|| (!Is|Inf(*sdP|
|00002a90| 74 72 29 20 26 26 20 66 | 61 62 73 28 2a 73 64 50 |tr) && f|abs(*sdP|
|00002aa0| 74 72 2f 75 6e 63 6c 69 | 70 70 65 64 53 64 53 61 |tr/uncli|ppedSdSa|
|00002ab0| 76 65 2d 31 29 3e 2e 30 | 31 29 29 7b 0d 09 09 09 |ve-1)>.0|1)){....|
|00002ac0| 09 2f 2f 20 74 61 6b 65 | 73 20 33 30 30 20 6d 73 |.// take|s 300 ms|
|00002ad0| 0d 09 09 09 09 42 6f 75 | 6e 64 65 64 4e 6f 72 6d |.....Bou|ndedNorm|
|00002ae0| 61 6c 49 6e 74 65 67 65 | 72 73 28 2a 64 69 73 74 |alIntege|rs(*dist|
|00002af0| 72 69 62 75 74 69 6f 6e | 48 61 6e 64 6c 65 2c 64 |ribution|Handle,d|
|00002b00| 69 73 74 72 69 62 75 74 | 69 6f 6e 53 69 7a 65 0d |istribut|ionSize.|
|00002b10| 09 09 09 09 09 2c 2a 6d | 65 61 6e 50 74 72 2c 2a |.....,*m|eanPtr,*|
|00002b20| 73 64 50 74 72 2c 6c 6f | 77 2c 68 69 67 68 29 3b |sdPtr,lo|w,high);|
|00002b30| 0d 09 09 09 7d 65 6c 73 | 65 7b 0d 09 09 09 09 6a |....}els|e{.....j|
|00002b40| 3d 72 6f 75 6e 64 28 2a | 6d 65 61 6e 50 74 72 2d |=round(*|meanPtr-|
|00002b50| 6d 65 61 6e 53 61 76 65 | 29 3b 0d 09 09 09 09 64 |meanSave|);.....d|
|00002b60| 69 73 74 72 69 62 75 74 | 69 6f 6e 3d 2a 64 69 73 |istribut|ion=*dis|
|00002b70| 74 72 69 62 75 74 69 6f | 6e 48 61 6e 64 6c 65 3b |tributio|nHandle;|
|00002b80| 0d 09 09 09 09 69 66 28 | 6a 21 3d 30 29 66 6f 72 |.....if(|j!=0)for|
|00002b90| 28 69 3d 30 3b 69 3c 64 | 69 73 74 72 69 62 75 74 |(i=0;i<d|istribut|
|00002ba0| 69 6f 6e 53 69 7a 65 3b | 69 2b 2b 29 64 69 73 74 |ionSize;|i++)dist|
|00002bb0| 72 69 62 75 74 69 6f 6e | 5b 69 5d 2b 3d 6a 3b 0d |ribution|[i]+=j;.|
|00002bc0| 09 09 09 09 2a 6d 65 61 | 6e 50 74 72 3d 6d 65 61 |....*mea|nPtr=mea|
|00002bd0| 6e 53 61 76 65 2b 6a 3b | 0d 09 09 09 7d 0d 09 09 |nSave+j;|....}...|
|00002be0| 09 6c 6f 77 53 61 76 65 | 3d 6c 6f 77 3b 0d 09 09 |.lowSave|=low;...|
|00002bf0| 09 68 69 67 68 53 61 76 | 65 3d 68 69 67 68 3b 0d |.highSav|e=high;.|
|00002c00| 09 09 09 75 6e 63 6c 69 | 70 70 65 64 53 64 53 61 |...uncli|ppedSdSa|
|00002c10| 76 65 3d 2a 73 64 50 74 | 72 3b 0d 09 09 09 6d 65 |ve=*sdPt|r;....me|
|00002c20| 61 6e 53 61 76 65 3d 2a | 6d 65 61 6e 50 74 72 3b |anSave=*|meanPtr;|
|00002c30| 0d 09 09 09 61 63 74 75 | 61 6c 4d 65 61 6e 3d 4d |....actu|alMean=M|
|00002c40| 65 61 6e 57 28 2a 64 69 | 73 74 72 69 62 75 74 69 |eanW(*di|stributi|
|00002c50| 6f 6e 48 61 6e 64 6c 65 | 2c 64 69 73 74 72 69 62 |onHandle|,distrib|
|00002c60| 75 74 69 6f 6e 53 69 7a | 65 2c 26 61 63 74 75 61 |utionSiz|e,&actua|
|00002c70| 6c 53 64 53 61 76 65 29 | 3b 0d 09 09 7d 0d 09 09 |lSdSave)|;...}...|
|00002c80| 61 63 74 75 61 6c 53 64 | 3d 61 63 74 75 61 6c 53 |actualSd|=actualS|
|00002c90| 64 53 61 76 65 3b 0d 09 | 09 61 73 73 65 72 74 28 |dSave;..|.assert(|
|00002ca0| 72 65 63 74 50 74 72 2d | 3e 72 69 67 68 74 2d 72 |rectPtr-|>right-r|
|00002cb0| 65 63 74 50 74 72 2d 3e | 6c 65 66 74 3c 3d 73 69 |ectPtr->|left<=si|
|00002cc0| 7a 65 6f 66 28 70 69 78 | 29 2f 73 69 7a 65 6f 66 |zeof(pix|)/sizeof|
|00002cd0| 28 2a 70 69 78 29 29 3b | 0d 09 09 2f 2f 48 4c 6f |(*pix));|...//HLo|
|00002ce0| 63 6b 28 28 48 61 6e 64 | 6c 65 29 64 69 73 74 72 |ck((Hand|le)distr|
|00002cf0| 69 62 75 74 69 6f 6e 48 | 61 6e 64 6c 65 29 3b 0d |ibutionH|andle);.|
|00002d00| 09 09 64 69 73 74 72 69 | 62 75 74 69 6f 6e 3d 2a |..distri|bution=*|
|00002d10| 64 69 73 74 72 69 62 75 | 74 69 6f 6e 48 61 6e 64 |distribu|tionHand|
|00002d20| 6c 65 3b 0d 09 09 66 6f | 72 28 79 3d 72 65 63 74 |le;...fo|r(y=rect|
|00002d30| 50 74 72 2d 3e 74 6f 70 | 3b 79 3c 72 65 63 74 50 |Ptr->top|;y<rectP|
|00002d40| 74 72 2d 3e 62 6f 74 74 | 6f 6d 3b 79 2b 2b 29 7b |tr->bott|om;y++){|
|00002d50| 0d 09 09 09 70 4c 3d 28 | 6c 6f 6e 67 20 2a 29 70 |....pL=(|long *)p|
|00002d60| 69 78 3b 0d 09 09 09 66 | 6f 72 28 78 3d 72 65 63 |ix;....f|or(x=rec|
|00002d70| 74 50 74 72 2d 3e 72 69 | 67 68 74 2d 72 65 63 74 |tPtr->ri|ght-rect|
|00002d80| 50 74 72 2d 3e 6c 65 66 | 74 2d 31 3b 78 3e 3d 30 |Ptr->lef|t-1;x>=0|
|00002d90| 3b 78 2d 2d 29 0d 09 09 | 09 09 2a 70 4c 2b 2b 3d |;x--)...|..*pL++=|
|00002da0| 64 69 73 74 72 69 62 75 | 74 69 6f 6e 5b 6e 72 61 |distribu|tion[nra|
|00002db0| 6e 64 28 64 69 73 74 72 | 69 62 75 74 69 6f 6e 53 |nd(distr|ibutionS|
|00002dc0| 69 7a 65 29 5d 3b 0d 09 | 09 09 53 65 74 57 69 6e |ize)];..|..SetWin|
|00002dd0| 64 6f 77 50 69 78 65 6c | 73 51 75 69 63 6b 6c 79 |dowPixel|sQuickly|
|00002de0| 28 28 57 69 6e 64 6f 77 | 50 74 72 29 77 6f 72 6c |((Window|Ptr)worl|
|00002df0| 64 2c 72 65 63 74 50 74 | 72 2d 3e 6c 65 66 74 2c |d,rectPt|r->left,|
|00002e00| 79 0d 09 09 09 09 2c 70 | 69 78 2c 72 65 63 74 50 |y.....,p|ix,rectP|
|00002e10| 74 72 2d 3e 72 69 67 68 | 74 2d 72 65 63 74 50 74 |tr->righ|t-rectPt|
|00002e20| 72 2d 3e 6c 65 66 74 29 | 3b 0d 09 09 7d 0d 09 09 |r->left)|;...}...|
|00002e30| 69 66 28 64 69 61 67 6e | 6f 73 74 69 63 73 29 70 |if(diagn|ostics)p|
|00002e40| 72 69 6e 74 66 28 22 75 | 6e 63 6c 69 70 70 65 64 |rintf("u|nclipped|
|00002e50| 53 64 20 25 66 2c 20 61 | 63 74 75 61 6c 53 64 20 |Sd %f, a|ctualSd |
|00002e60| 25 66 2c 20 61 63 74 75 | 61 6c 53 64 2f 75 6e 63 |%f, actu|alSd/unc|
|00002e70| 6c 69 70 70 65 64 53 64 | 20 25 66 5c 6e 22 0d 09 |lippedSd| %f\n"..|
|00002e80| 09 09 2c 2a 73 64 50 74 | 72 2c 61 63 74 75 61 6c |..,*sdPt|r,actual|
|00002e90| 53 64 2c 61 63 74 75 61 | 6c 53 64 2f 28 2a 73 64 |Sd,actua|lSd/(*sd|
|00002ea0| 50 74 72 29 29 3b 0d 09 | 09 62 72 65 61 6b 3b 0d |Ptr));..|.break;.|
|00002eb0| 09 63 61 73 65 20 6b 42 | 69 6e 6f 6d 69 61 6c 50 |.case kB|inomialP|
|00002ec0| 64 66 3a 0d 09 09 2f 2f | 20 55 73 65 20 74 68 65 |df:...//| Use the|
|00002ed0| 20 6e 75 6d 62 65 72 20 | 6f 66 20 68 65 61 64 73 | number |of heads|
|00002ee0| 20 69 6e 20 32 34 20 63 | 6f 69 6e 20 66 6c 69 70 | in 24 c|oin flip|
|00002ef0| 73 20 61 73 20 61 20 72 | 61 6e 64 6f 6d 20 76 61 |s as a r|andom va|
|00002f00| 72 69 61 62 6c 65 2e 0d | 09 09 2f 2f 20 49 74 20 |riable..|..// It |
|00002f10| 63 61 6e 20 62 65 20 63 | 6f 6d 70 75 74 65 64 20 |can be c|omputed |
|00002f20| 71 75 69 63 6b 6c 79 20 | 61 6e 64 20 69 73 20 61 |quickly |and is a|
|00002f30| 70 70 72 6f 78 69 6d 61 | 74 65 6c 79 20 6e 6f 72 |pproxima|tely nor|
|00002f40| 6d 61 6c 2e 0d 09 09 2f | 2f 20 53 68 69 66 74 20 |mal..../|/ Shift |
|00002f50| 61 6e 64 20 73 63 61 6c | 65 20 74 6f 20 6f 62 74 |and scal|e to obt|
|00002f60| 61 69 6e 20 74 68 65 20 | 73 70 65 63 69 66 69 65 |ain the |specifie|
|00002f70| 64 20 6d 65 61 6e 20 61 | 6e 64 20 76 61 72 69 61 |d mean a|nd varia|
|00002f80| 6e 63 65 2e 0d 09 09 2f | 2f 20 44 69 73 63 61 72 |nce..../|/ Discar|
|00002f90| 64 20 73 61 6d 70 6c 65 | 73 20 6f 75 74 73 69 64 |d sample|s outsid|
|00002fa0| 65 20 74 68 65 20 72 61 | 6e 67 65 20 5b 6d 69 6e |e the ra|nge [min|
|00002fb0| 2c 6d 61 78 5d 2e 0d 09 | 09 2f 2f 20 52 65 74 75 |,max]...|.// Retu|
|00002fc0| 72 6e 20 6d 65 61 6e 20 | 61 6e 64 20 73 64 20 6f |rn mean |and sd o|
|00002fd0| 66 20 74 68 65 20 63 6c | 69 70 70 65 64 20 64 69 |f the cl|ipped di|
|00002fe0| 73 74 72 69 62 75 74 69 | 6f 6e 2e 0d 09 09 62 69 |stributi|on....bi|
|00002ff0| 6e 6f 6d 69 61 6c 53 61 | 6d 70 6c 65 73 3d 32 34 |nomialSa|mples=24|
|00003000| 3b 09 2f 2f 20 73 68 6f | 75 6c 64 20 62 65 20 65 |;.// sho|uld be e|
|00003010| 76 65 6e 20 28 66 6f 72 | 20 69 6e 74 65 67 65 72 |ven (for| integer|
|00003020| 20 64 69 76 69 64 65 20 | 62 79 20 32 29 0d 09 09 | divide |by 2)...|
|00003030| 62 69 6e 6f 6d 69 61 6c | 46 61 63 74 6f 72 3d 2a |binomial|Factor=*|
|00003040| 73 64 50 74 72 2f 73 71 | 72 74 28 62 69 6e 6f 6d |sdPtr/sq|rt(binom|
|00003050| 69 61 6c 53 61 6d 70 6c | 65 73 2a 30 2e 32 35 29 |ialSampl|es*0.25)|
|00003060| 3b 0d 09 09 2f 2a 0d 09 | 09 54 68 65 20 65 6d 70 |;.../*..|.The emp|
|00003070| 69 72 69 63 61 6c 20 61 | 70 70 72 6f 61 63 68 20 |irical a|pproach |
|00003080| 6f 66 20 61 63 74 75 61 | 6c 6c 79 20 6d 65 61 73 |of actua|lly meas|
|00003090| 75 72 69 6e 67 20 74 68 | 65 20 6d 65 61 6e 20 61 |uring th|e mean a|
|000030a0| 6e 64 20 76 61 72 69 61 | 6e 63 65 0d 09 09 6f 66 |nd varia|nce...of|
|000030b0| 20 6f 75 72 20 6e 6f 69 | 73 65 20 67 65 6e 65 72 | our noi|se gener|
|000030c0| 61 74 6f 72 20 64 65 6d | 61 6e 64 73 20 74 68 61 |ator dem|ands tha|
|000030d0| 74 20 77 65 20 70 72 6f | 64 75 63 65 20 61 0d 09 |t we pro|duce a..|
|000030e0| 09 72 65 61 73 6f 6e 61 | 62 6c 65 20 6e 75 6d 62 |.reasona|ble numb|
|000030f0| 65 72 20 6f 66 20 73 61 | 6d 70 6c 65 73 2c 20 61 |er of sa|mples, a|
|00003100| 74 20 6c 65 61 73 74 20 | 31 30 30 30 2e 20 41 6e |t least |1000. An|
|00003110| 79 20 65 78 74 72 61 20 | 73 61 6d 70 6c 65 73 20 |y extra |samples |
|00003120| 61 72 65 20 6c 61 74 65 | 72 0d 09 09 64 69 73 63 |are late|r...disc|
|00003130| 61 72 64 65 64 2e 0d 09 | 09 2a 2f 0d 09 09 61 73 |arded...|.*/...as|
|00003140| 73 65 72 74 28 72 65 63 | 74 50 74 72 2d 3e 72 69 |sert(rec|tPtr->ri|
|00003150| 67 68 74 2d 72 65 63 74 | 50 74 72 2d 3e 6c 65 66 |ght-rect|Ptr->lef|
|00003160| 74 3c 3d 73 69 7a 65 6f | 66 28 70 69 78 29 2f 73 |t<=sizeo|f(pix)/s|
|00003170| 69 7a 65 6f 66 28 2a 70 | 69 78 29 29 3b 0d 09 09 |izeof(*p|ix));...|
|00003180| 65 78 74 72 61 53 61 6d | 70 6c 65 73 3d 63 65 69 |extraSam|ples=cei|
|00003190| 6c 28 31 30 30 30 2e 30 | 2f 28 72 65 63 74 50 74 |l(1000.0|/(rectPt|
|000031a0| 72 2d 3e 62 6f 74 74 6f | 6d 2d 72 65 63 74 50 74 |r->botto|m-rectPt|
|000031b0| 72 2d 3e 74 6f 70 29 29 | 0d 09 09 09 2d 28 72 65 |r->top))|....-(re|
|000031c0| 63 74 50 74 72 2d 3e 72 | 69 67 68 74 2d 72 65 63 |ctPtr->r|ight-rec|
|000031d0| 74 50 74 72 2d 3e 6c 65 | 66 74 29 3b 0d 09 09 69 |tPtr->le|ft);...i|
|000031e0| 66 28 65 78 74 72 61 53 | 61 6d 70 6c 65 73 3c 30 |f(extraS|amples<0|
|000031f0| 29 65 78 74 72 61 53 61 | 6d 70 6c 65 73 3d 30 3b |)extraSa|mples=0;|
|00003200| 0d 09 09 61 3d 61 61 3d | 30 2e 30 3b 0d 09 09 6e |...a=aa=|0.0;...n|
|00003210| 3d 30 3b 0d 09 09 66 6f | 72 28 79 3d 72 65 63 74 |=0;...fo|r(y=rect|
|00003220| 50 74 72 2d 3e 74 6f 70 | 3b 20 79 3c 72 65 63 74 |Ptr->top|; y<rect|
|00003230| 50 74 72 2d 3e 62 6f 74 | 74 6f 6d 3b 20 79 2b 2b |Ptr->bot|tom; y++|
|00003240| 29 7b 0d 09 09 09 70 4c | 3d 28 6c 6f 6e 67 20 2a |){....pL|=(long *|
|00003250| 29 70 69 78 3b 0d 09 09 | 09 66 6f 72 28 78 3d 72 |)pix;...|.for(x=r|
|00003260| 65 63 74 50 74 72 2d 3e | 72 69 67 68 74 2d 72 65 |ectPtr->|right-re|
|00003270| 63 74 50 74 72 2d 3e 6c | 65 66 74 2d 31 3b 20 78 |ctPtr->l|eft-1; x|
|00003280| 3e 3d 2d 65 78 74 72 61 | 53 61 6d 70 6c 65 73 3b |>=-extra|Samples;|
|00003290| 20 78 2d 2d 29 7b 0d 09 | 09 09 09 64 6f 7b 0d 09 | x--){..|...do{..|
|000032a0| 09 09 09 09 73 61 6d 70 | 6c 65 3d 72 6f 75 6e 64 |....samp|le=round|
|000032b0| 28 2a 6d 65 61 6e 50 74 | 72 2b 62 69 6e 6f 6d 69 |(*meanPt|r+binomi|
|000032c0| 61 6c 46 61 63 74 6f 72 | 0d 09 09 09 09 09 09 2a |alFactor|.......*|
|000032d0| 28 42 69 6e 6f 6d 69 61 | 6c 53 61 6d 70 6c 65 51 |(Binomia|lSampleQ|
|000032e0| 75 69 63 6b 6c 79 28 62 | 69 6e 6f 6d 69 61 6c 53 |uickly(b|inomialS|
|000032f0| 61 6d 70 6c 65 73 29 2d | 62 69 6e 6f 6d 69 61 6c |amples)-|binomial|
|00003300| 53 61 6d 70 6c 65 73 2f | 32 29 29 3b 0d 09 09 09 |Samples/|2));....|
|00003310| 09 7d 77 68 69 6c 65 28 | 73 61 6d 70 6c 65 3c 6c |.}while(|sample<l|
|00003320| 6f 77 20 7c 7c 20 73 61 | 6d 70 6c 65 3e 68 69 67 |ow || sa|mple>hig|
|00003330| 68 29 3b 0d 09 09 09 09 | 61 2b 3d 73 61 6d 70 6c |h);.....|a+=sampl|
|00003340| 65 3b 0d 09 09 09 09 61 | 61 2b 3d 28 6c 6f 6e 67 |e;.....a|a+=(long|
|00003350| 29 73 61 6d 70 6c 65 2a | 28 6c 6f 6e 67 29 73 61 |)sample*|(long)sa|
|00003360| 6d 70 6c 65 3b 0d 09 09 | 09 09 6e 2b 2b 3b 0d 09 |mple;...|..n++;..|
|00003370| 09 09 09 69 66 28 78 3e | 3d 30 29 2a 70 4c 2b 2b |...if(x>|=0)*pL++|
|00003380| 3d 73 61 6d 70 6c 65 3b | 0d 09 09 09 7d 0d 09 09 |=sample;|....}...|
|00003390| 09 53 65 74 57 69 6e 64 | 6f 77 50 69 78 65 6c 73 |.SetWind|owPixels|
|000033a0| 51 75 69 63 6b 6c 79 28 | 28 57 69 6e 64 6f 77 50 |Quickly(|(WindowP|
|000033b0| 74 72 29 77 6f 72 6c 64 | 2c 72 65 63 74 50 74 72 |tr)world|,rectPtr|
|000033c0| 2d 3e 6c 65 66 74 2c 79 | 0d 09 09 09 09 2c 70 69 |->left,y|.....,pi|
|000033d0| 78 2c 72 65 63 74 50 74 | 72 2d 3e 72 69 67 68 74 |x,rectPt|r->right|
|000033e0| 2d 72 65 63 74 50 74 72 | 2d 3e 6c 65 66 74 29 3b |-rectPtr|->left);|
|000033f0| 0d 09 09 7d 0d 09 09 61 | 63 74 75 61 6c 4d 65 61 |...}...a|ctualMea|
|00003400| 6e 3d 61 2f 6e 3b 0d 09 | 09 61 63 74 75 61 6c 53 |n=a/n;..|.actualS|
|00003410| 64 3d 73 71 72 74 28 61 | 61 2f 6e 2d 61 63 74 75 |d=sqrt(a|a/n-actu|
|00003420| 61 6c 4d 65 61 6e 2a 61 | 63 74 75 61 6c 4d 65 61 |alMean*a|ctualMea|
|00003430| 6e 29 3b 0d 09 09 69 66 | 28 64 69 61 67 6e 6f 73 |n);...if|(diagnos|
|00003440| 74 69 63 73 29 70 72 69 | 6e 74 66 28 22 75 6e 63 |tics)pri|ntf("unc|
|00003450| 6c 69 70 70 65 64 53 64 | 20 25 66 2c 20 61 63 74 |lippedSd| %f, act|
|00003460| 75 61 6c 53 64 20 25 66 | 2c 20 61 63 74 75 61 6c |ualSd %f|, actual|
|00003470| 53 64 2f 75 6e 63 6c 69 | 70 70 65 64 53 64 20 25 |Sd/uncli|ppedSd %|
|00003480| 66 2c 20 6e 20 25 6c 64 | 5c 6e 22 0d 09 09 09 2c |f, n %ld|\n"....,|
|00003490| 2a 73 64 50 74 72 2c 61 | 63 74 75 61 6c 53 64 2c |*sdPtr,a|ctualSd,|
|000034a0| 61 63 74 75 61 6c 53 64 | 2f 28 2a 73 64 50 74 72 |actualSd|/(*sdPtr|
|000034b0| 29 2c 6e 29 3b 0d 09 09 | 62 72 65 61 6b 3b 0d 09 |),n);...|break;..|
|000034c0| 64 65 66 61 75 6c 74 3a | 0d 09 09 50 72 69 6e 74 |default:|...Print|
|000034d0| 66 45 78 69 74 28 22 25 | 73 2c 25 64 3a 20 4e 6f |fExit("%|s,%d: No|
|000034e0| 20 73 75 63 68 20 70 64 | 66 20 25 64 5c 6e 22 2c | such pd|f %d\n",|
|000034f0| 5f 5f 46 49 4c 45 5f 5f | 2c 5f 5f 4c 49 4e 45 5f |__FILE__|,__LINE_|
|00003500| 5f 2c 28 69 6e 74 29 70 | 64 66 4b 69 6e 64 29 3b |_,(int)p|dfKind);|
|00003510| 0d 09 7d 0d 09 69 66 28 | 64 69 61 67 6e 6f 73 74 |..}..if(|diagnost|
|00003520| 69 63 73 29 7b 0d 09 09 | 49 6d 61 67 65 53 74 61 |ics){...|ImageSta|
|00003530| 74 69 73 74 69 63 73 28 | 77 6f 72 6c 64 2c 72 65 |tistics(|world,re|
|00003540| 63 74 50 74 72 2c 26 61 | 63 74 75 61 6c 4d 69 6e |ctPtr,&a|ctualMin|
|00003550| 2c 26 61 63 74 75 61 6c | 4d 61 78 2c 26 61 63 74 |,&actual|Max,&act|
|00003560| 75 61 6c 4d 65 61 6e 2c | 26 6d 65 61 6e 53 71 75 |ualMean,|&meanSqu|
|00003570| 61 72 65 29 3b 0d 09 09 | 69 66 28 61 63 74 75 61 |are);...|if(actua|
|00003580| 6c 4d 61 78 3e 6d 61 78 | 20 7c 7c 20 61 63 74 75 |lMax>max| || actu|
|00003590| 61 6c 4d 69 6e 3c 6d 69 | 6e 29 70 72 69 6e 74 66 |alMin<mi|n)printf|
|000035a0| 28 22 5c 6e 49 4d 41 47 | 45 20 4f 56 45 52 46 4c |("\nIMAG|E OVERFL|
|000035b0| 4f 57 20 45 52 52 4f 52 | 3a 5c 6e 22 29 3b 0d 09 |OW ERROR|:\n");..|
|000035c0| 09 70 72 69 6e 74 66 28 | 22 6e 6f 69 73 65 20 61 |.printf(|"noise a|
|000035d0| 63 74 75 61 6c 4d 69 6e | 20 25 6c 64 b3 25 64 2c |ctualMin| %ld.%d,|
|000035e0| 20 61 63 74 75 61 6c 4d | 61 78 20 25 6c 64 b2 25 | actualM|ax %ld.%|
|000035f0| 64 2c 20 61 63 74 75 61 | 6c 4d 65 61 6e 20 25 2e |d, actua|lMean %.|
|00003600| 31 66 c5 25 2e 31 66 2c | 20 72 6d 73 20 25 2e 31 |1f.%.1f,| rms %.1|
|00003610| 66 c5 25 2e 31 66 c5 25 | 2e 31 66 5c 6e 22 0d 09 |f.%.1f.%|.1f\n"..|
|00003620| 09 09 2c 61 63 74 75 61 | 6c 4d 69 6e 2c 28 69 6e |..,actua|lMin,(in|
|00003630| 74 29 6d 69 6e 0d 09 09 | 09 2c 61 63 74 75 61 6c |t)min...|.,actual|
|00003640| 4d 61 78 2c 28 69 6e 74 | 29 6d 61 78 0d 09 09 09 |Max,(int|)max....|
|00003650| 2c 61 63 74 75 61 6c 4d | 65 61 6e 2c 2a 6d 65 61 |,actualM|ean,*mea|
|00003660| 6e 50 74 72 0d 09 09 09 | 2c 73 71 72 74 28 6d 65 |nPtr....|,sqrt(me|
|00003670| 61 6e 53 71 75 61 72 65 | 29 2c 61 63 74 75 61 6c |anSquare|),actual|
|00003680| 53 64 2c 2a 73 64 50 74 | 72 29 3b 0d 09 09 61 73 |Sd,*sdPt|r);...as|
|00003690| 73 65 72 74 28 61 63 74 | 75 61 6c 4d 61 78 3c 3d |sert(act|ualMax<=|
|000036a0| 6d 61 78 20 26 26 20 61 | 63 74 75 61 6c 4d 69 6e |max && a|ctualMin|
|000036b0| 3e 3d 6d 69 6e 29 3b 0d | 09 7d 0d 64 6f 6e 65 3a |>=min);.|.}.done:|
|000036c0| 0d 09 2a 73 64 50 74 72 | 3d 61 63 74 75 61 6c 53 |..*sdPtr|=actualS|
|000036d0| 64 3b 0d 09 2a 6d 65 61 | 6e 50 74 72 3d 61 63 74 |d;..*mea|nPtr=act|
|000036e0| 75 61 6c 4d 65 61 6e 3b | 0d 09 72 65 74 75 72 6e |ualMean;|..return|
|000036f0| 20 65 72 72 6f 72 3b 0d | 7d 0d 0d 4f 53 45 72 72 | error;.|}..OSErr|
|00003700| 20 4e 6f 69 73 65 50 64 | 66 41 64 64 28 47 57 6f | NoisePd|fAdd(GWo|
|00003710| 72 6c 64 50 74 72 20 77 | 6f 72 6c 64 2c 52 65 63 |rldPtr w|orld,Rec|
|00003720| 74 20 2a 72 65 63 74 50 | 74 72 0d 09 2c 69 6e 74 |t *rectP|tr..,int|
|00003730| 20 70 64 66 4b 69 6e 64 | 2c 64 6f 75 62 6c 65 20 | pdfKind|,double |
|00003740| 2a 6d 65 61 6e 50 74 72 | 2c 64 6f 75 62 6c 65 20 |*meanPtr|,double |
|00003750| 2a 73 64 50 74 72 2c 69 | 6e 74 20 6d 69 6e 2c 69 |*sdPtr,i|nt min,i|
|00003760| 6e 74 20 6d 61 78 29 0d | 7b 0d 09 47 57 6f 72 6c |nt max).|{..GWorl|
|00003770| 64 50 74 72 20 6e 6f 69 | 73 65 57 6f 72 6c 64 3b |dPtr noi|seWorld;|
|00003780| 0d 09 47 44 48 61 6e 64 | 6c 65 20 64 65 76 69 63 |..GDHand|le devic|
|00003790| 65 3b 0d 09 69 6e 74 20 | 65 72 72 6f 72 3d 30 2c |e;..int |error=0,|
|000037a0| 70 69 78 65 6c 53 69 7a | 65 3b 0d 20 20 20 20 64 |pixelSiz|e;. d|
|000037b0| 6f 75 62 6c 65 20 6d 65 | 61 6e 53 71 75 61 72 65 |ouble me|anSquare|
|000037c0| 2c 61 63 74 75 61 6c 4d | 65 61 6e 3b 0d 09 6c 6f |,actualM|ean;..lo|
|000037d0| 6e 67 20 61 63 74 75 61 | 6c 4d 69 6e 2c 61 63 74 |ng actua|lMin,act|
|000037e0| 75 61 6c 4d 61 78 3b 0d | 09 43 6f 6c 6f 72 54 61 |ualMax;.|.ColorTa|
|000037f0| 62 6c 65 20 2a 2a 63 74 | 3b 0d 09 6c 6f 6e 67 20 |ble **ct|;..long |
|00003800| 63 6f 70 79 4d 6f 64 65 | 3b 0d 0d 09 61 73 73 65 |copyMode|;...asse|
|00003810| 72 74 28 77 6f 72 6c 64 | 21 3d 4e 55 4c 4c 29 3b |rt(world|!=NULL);|
|00003820| 0d 09 64 65 76 69 63 65 | 3d 47 65 74 57 69 6e 64 |..device|=GetWind|
|00003830| 6f 77 44 65 76 69 63 65 | 28 28 57 69 6e 64 6f 77 |owDevice|((Window|
|00003840| 50 74 72 29 77 6f 72 6c | 64 29 3b 0d 09 70 69 78 |Ptr)worl|d);..pix|
|00003850| 65 6c 53 69 7a 65 3d 28 | 2a 2a 28 2a 2a 64 65 76 |elSize=(|**(**dev|
|00003860| 69 63 65 29 2e 67 64 50 | 4d 61 70 29 2e 70 69 78 |ice).gdP|Map).pix|
|00003870| 65 6c 53 69 7a 65 3b 0d | 09 63 74 3d 47 65 74 43 |elSize;.|.ct=GetC|
|00003880| 54 61 62 6c 65 28 70 69 | 78 65 6c 53 69 7a 65 2b |Table(pi|xelSize+|
|00003890| 33 32 29 3b 09 2f 2f 20 | 67 72 61 79 20 72 61 6d |32);.// |gray ram|
|000038a0| 70 0d 09 61 73 73 65 72 | 74 28 63 74 21 3d 4e 55 |p..asser|t(ct!=NU|
|000038b0| 4c 4c 29 3b 0d 09 65 72 | 72 6f 72 3d 4e 65 77 47 |LL);..er|ror=NewG|
|000038c0| 57 6f 72 6c 64 28 26 6e | 6f 69 73 65 57 6f 72 6c |World(&n|oiseWorl|
|000038d0| 64 2c 70 69 78 65 6c 53 | 69 7a 65 2c 72 65 63 74 |d,pixelS|ize,rect|
|000038e0| 50 74 72 2c 63 74 2c 30 | 2c 30 29 3b 0d 09 69 66 |Ptr,ct,0|,0);..if|
|000038f0| 28 65 72 72 6f 72 29 65 | 72 72 6f 72 3d 4e 65 77 |(error)e|rror=New|
|00003900| 47 57 6f 72 6c 64 28 26 | 6e 6f 69 73 65 57 6f 72 |GWorld(&|noiseWor|
|00003910| 6c 64 2c 70 69 78 65 6c | 53 69 7a 65 2c 72 65 63 |ld,pixel|Size,rec|
|00003920| 74 50 74 72 2c 63 74 2c | 30 2c 75 73 65 54 65 6d |tPtr,ct,|0,useTem|
|00003930| 70 4d 65 6d 29 3b 0d 09 | 69 66 28 65 72 72 6f 72 |pMem);..|if(error|
|00003940| 29 72 65 74 75 72 6e 20 | 65 72 72 6f 72 3b 0d 09 |)return |error;..|
|00003950| 65 72 72 6f 72 3d 4e 6f | 69 73 65 50 64 66 46 69 |error=No|isePdfFi|
|00003960| 6c 6c 28 6e 6f 69 73 65 | 57 6f 72 6c 64 2c 72 65 |ll(noise|World,re|
|00003970| 63 74 50 74 72 2c 70 64 | 66 4b 69 6e 64 2c 6d 65 |ctPtr,pd|fKind,me|
|00003980| 61 6e 50 74 72 2c 73 64 | 50 74 72 2c 6d 69 6e 2c |anPtr,sd|Ptr,min,|
|00003990| 6d 61 78 29 3b 0d 09 69 | 66 28 65 72 72 6f 72 29 |max);..i|f(error)|
|000039a0| 67 6f 74 6f 20 64 6f 6e | 65 3b 0d 09 69 66 28 6d |goto don|e;..if(m|
|000039b0| 69 6e 3e 3d 30 29 63 6f | 70 79 4d 6f 64 65 3d 61 |in>=0)co|pyMode=a|
|000039c0| 64 64 4f 76 65 72 50 61 | 72 61 6c 6c 65 6c 4c 69 |ddOverPa|rallelLi|
|000039d0| 74 65 72 61 6c 6c 79 3b | 09 2f 2f 20 6e 6f 20 6f |terally;|.// no o|
|000039e0| 76 65 72 66 6c 6f 77 0d | 09 65 6c 73 65 20 63 6f |verflow.|.else co|
|000039f0| 70 79 4d 6f 64 65 3d 61 | 64 64 4f 76 65 72 3b 09 |pyMode=a|ddOver;.|
|00003a00| 09 09 09 09 09 09 2f 2f | 20 22 73 69 67 6e 22 20 |......//| "sign" |
|00003a10| 62 69 74 20 6d 61 79 20 | 6f 76 65 72 66 6c 6f 77 |bit may |overflow|
|00003a20| 0d 09 65 72 72 6f 72 3d | 43 6f 70 79 57 69 6e 64 |..error=|CopyWind|
|00003a30| 6f 77 73 28 6e 6f 69 73 | 65 57 6f 72 6c 64 2c 77 |ows(nois|eWorld,w|
|00003a40| 6f 72 6c 64 2c 72 65 63 | 74 50 74 72 2c 72 65 63 |orld,rec|tPtr,rec|
|00003a50| 74 50 74 72 2c 63 6f 70 | 79 4d 6f 64 65 2c 4e 55 |tPtr,cop|yMode,NU|
|00003a60| 4c 4c 29 3b 0d 09 69 66 | 28 65 72 72 6f 72 29 50 |LL);..if|(error)P|
|00003a70| 72 69 6e 74 66 45 78 69 | 74 28 22 25 73 20 6c 69 |rintfExi|t("%s li|
|00003a80| 6e 65 20 25 64 3a 20 43 | 6f 70 79 57 69 6e 64 6f |ne %d: C|opyWindo|
|00003a90| 77 73 20 65 72 72 6f 72 | 20 25 64 5c 6e 22 2c 5f |ws error| %d\n",_|
|00003aa0| 5f 46 49 4c 45 5f 5f 2c | 5f 5f 4c 49 4e 45 5f 5f |_FILE__,|__LINE__|
|00003ab0| 2c 65 72 72 6f 72 29 3b | 0d 09 69 66 28 64 69 61 |,error);|..if(dia|
|00003ac0| 67 6e 6f 73 74 69 63 73 | 29 7b 0d 09 09 49 6d 61 |gnostics|){...Ima|
|00003ad0| 67 65 53 74 61 74 69 73 | 74 69 63 73 28 77 6f 72 |geStatis|tics(wor|
|00003ae0| 6c 64 2c 26 77 6f 72 6c | 64 2d 3e 70 6f 72 74 52 |ld,&worl|d->portR|
|00003af0| 65 63 74 2c 26 61 63 74 | 75 61 6c 4d 69 6e 2c 26 |ect,&act|ualMin,&|
|00003b00| 61 63 74 75 61 6c 4d 61 | 78 2c 26 61 63 74 75 61 |actualMa|x,&actua|
|00003b10| 6c 4d 65 61 6e 2c 26 6d | 65 61 6e 53 71 75 61 72 |lMean,&m|eanSquar|
|00003b20| 65 29 3b 0d 09 09 69 66 | 28 61 63 74 75 61 6c 4d |e);...if|(actualM|
|00003b30| 61 78 3e 6d 61 78 20 7c | 7c 20 61 63 74 75 61 6c |ax>max ||| actual|
|00003b40| 4d 69 6e 3c 6d 69 6e 20 | 7c 7c 20 64 69 61 67 6e |Min<min ||| diagn|
|00003b50| 6f 73 74 69 63 73 29 7b | 0d 09 09 09 70 72 69 6e |ostics){|....prin|
|00003b60| 74 66 28 22 73 69 67 6e | 61 6c 2b 6e 6f 69 73 65 |tf("sign|al+noise|
|00003b70| 20 61 63 74 75 61 6c 4d | 69 6e 20 25 6c 64 2c 20 | actualM|in %ld, |
|00003b80| 61 63 74 75 61 6c 4d 61 | 78 20 25 6c 64 2c 20 61 |actualMa|x %ld, a|
|00003b90| 63 74 75 61 6c 4d 65 61 | 6e 20 25 2e 31 66 2c 20 |ctualMea|n %.1f, |
|00003ba0| 61 63 74 75 61 6c 53 64 | 20 25 2e 31 66 5c 6e 22 |actualSd| %.1f\n"|
|00003bb0| 0d 09 09 09 09 2c 61 63 | 74 75 61 6c 4d 69 6e 2c |.....,ac|tualMin,|
|00003bc0| 61 63 74 75 61 6c 4d 61 | 78 2c 61 63 74 75 61 6c |actualMa|x,actual|
|00003bd0| 4d 65 61 6e 2c 73 71 72 | 74 28 6d 65 61 6e 53 71 |Mean,sqr|t(meanSq|
|00003be0| 75 61 72 65 2d 61 63 74 | 75 61 6c 4d 65 61 6e 2a |uare-act|ualMean*|
|00003bf0| 61 63 74 75 61 6c 4d 65 | 61 6e 29 29 3b 0d 09 09 |actualMe|an));...|
|00003c00| 7d 0d 09 7d 0d 64 6f 6e | 65 3a 0d 09 44 69 73 70 |}..}.don|e:..Disp|
|00003c10| 6f 73 65 47 57 6f 72 6c | 64 28 6e 6f 69 73 65 57 |oseGWorl|d(noiseW|
|00003c20| 6f 72 6c 64 29 3b 0d 09 | 72 65 74 75 72 6e 20 65 |orld);..|return e|
|00003c30| 72 72 6f 72 3b 0d 7d 0d | 0d 76 6f 69 64 20 47 65 |rror;.}.|.void Ge|
|00003c40| 74 47 6f 6f 64 4e 6f 69 | 73 65 50 64 66 42 6f 75 |tGoodNoi|sePdfBou|
|00003c50| 6e 64 73 28 69 6e 74 20 | 70 64 66 4b 69 6e 64 2c |nds(int |pdfKind,|
|00003c60| 64 6f 75 62 6c 65 20 6d | 65 61 6e 2c 64 6f 75 62 |double m|ean,doub|
|00003c70| 6c 65 20 63 6c 69 70 70 | 65 64 53 64 0d 09 2c 64 |le clipp|edSd..,d|
|00003c80| 6f 75 62 6c 65 20 2a 75 | 6e 63 6c 69 70 70 65 64 |ouble *u|nclipped|
|00003c90| 53 64 50 74 72 2c 69 6e | 74 20 2a 6d 69 6e 50 74 |SdPtr,in|t *minPt|
|00003ca0| 72 2c 69 6e 74 20 2a 6d | 61 78 50 74 72 29 0d 7b |r,int *m|axPtr).{|
|00003cb0| 0d 09 64 6f 75 62 6c 65 | 20 64 4d 61 78 2c 64 4d |..double| dMax,dM|
|00003cc0| 69 6e 3b 09 2f 2f 20 6e | 6f 6d 69 6e 61 6c 20 72 |in;.// n|ominal r|
|00003cd0| 61 6e 67 65 20 6f 66 20 | 64 69 66 66 65 72 65 6e |ange of |differen|
|00003ce0| 63 65 20 66 72 6f 6d 20 | 6d 65 61 6e 0d 09 64 6f |ce from |mean..do|
|00003cf0| 75 62 6c 65 20 63 6c 69 | 70 70 65 64 53 64 31 3b |uble cli|ppedSd1;|
|00003d00| 09 2f 2f 20 76 61 6c 75 | 65 20 6f 66 20 63 6c 69 |.// valu|e of cli|
|00003d10| 70 70 65 64 53 64 20 74 | 68 61 74 20 77 6f 75 6c |ppedSd t|hat woul|
|00003d20| 64 20 62 65 20 70 72 6f | 64 75 63 65 64 20 69 66 |d be pro|duced if|
|00003d30| 20 75 6e 63 6c 69 70 70 | 65 64 53 64 20 77 65 72 | unclipp|edSd wer|
|00003d40| 65 20 31 0d 09 69 6e 74 | 20 6c 6f 77 2c 68 69 67 |e 1..int| low,hig|
|00003d50| 68 3b 09 09 2f 2f 20 72 | 61 6e 67 65 20 6f 66 20 |h;..// r|ange of |
|00003d60| 64 69 66 66 65 72 65 6e | 63 65 20 66 72 6f 6d 20 |differen|ce from |
|00003d70| 6d 65 61 6e 0d 09 0d 09 | 61 73 73 65 72 74 28 75 |mean....|assert(u|
|00003d80| 6e 63 6c 69 70 70 65 64 | 53 64 50 74 72 21 3d 4e |nclipped|SdPtr!=N|
|00003d90| 55 4c 4c 20 26 26 20 6d | 69 6e 50 74 72 21 3d 4e |ULL && m|inPtr!=N|
|00003da0| 55 4c 4c 20 26 26 20 6d | 61 78 50 74 72 21 3d 4e |ULL && m|axPtr!=N|
|00003db0| 55 4c 4c 29 3b 0d 09 61 | 73 73 65 72 74 28 63 6c |ULL);..a|ssert(cl|
|00003dc0| 69 70 70 65 64 53 64 3e | 3d 30 29 3b 0d 09 61 73 |ippedSd>|=0);..as|
|00003dd0| 73 65 72 74 28 2a 6d 61 | 78 50 74 72 3e 3d 2a 6d |sert(*ma|xPtr>=*m|
|00003de0| 69 6e 50 74 72 29 3b 0d | 09 0d 09 73 77 69 74 63 |inPtr);.|...switc|
|00003df0| 68 28 70 64 66 4b 69 6e | 64 29 7b 0d 09 63 61 73 |h(pdfKin|d){..cas|
|00003e00| 65 20 6b 42 69 6e 61 72 | 79 50 64 66 3a 0d 09 09 |e kBinar|yPdf:...|
|00003e10| 64 4d 61 78 3d 63 6c 69 | 70 70 65 64 53 64 3b 0d |dMax=cli|ppedSd;.|
|00003e20| 09 09 64 4d 69 6e 3d 2d | 64 4d 61 78 3b 0d 09 09 |..dMin=-|dMax;...|
|00003e30| 63 6c 69 70 70 65 64 53 | 64 31 3d 31 3b 0d 09 09 |clippedS|d1=1;...|
|00003e40| 62 72 65 61 6b 3b 0d 09 | 63 61 73 65 20 6b 55 6e |break;..|case kUn|
|00003e50| 69 66 6f 72 6d 50 64 66 | 3a 0d 09 09 64 4d 61 78 |iformPdf|:...dMax|
|00003e60| 3d 73 71 72 74 28 33 29 | 2a 63 6c 69 70 70 65 64 |=sqrt(3)|*clipped|
|00003e70| 53 64 3b 0d 09 09 69 66 | 28 64 4d 61 78 3e 3d 31 |Sd;...if|(dMax>=1|
|00003e80| 29 64 4d 61 78 2d 3d 30 | 2e 35 3b 0d 09 09 64 4d |)dMax-=0|.5;...dM|
|00003e90| 69 6e 3d 2d 64 4d 61 78 | 3b 0d 09 09 63 6c 69 70 |in=-dMax|;...clip|
|00003ea0| 70 65 64 53 64 31 3d 31 | 3b 0d 09 09 62 72 65 61 |pedSd1=1|;...brea|
|00003eb0| 6b 3b 0d 09 63 61 73 65 | 20 6b 42 69 6e 6f 6d 69 |k;..case| kBinomi|
|00003ec0| 61 6c 50 64 66 3a 0d 09 | 09 64 4d 61 78 3d 32 2a |alPdf:..|.dMax=2*|
|00003ed0| 63 6c 69 70 70 65 64 53 | 64 3b 0d 09 09 64 4d 69 |clippedS|d;...dMi|
|00003ee0| 6e 3d 2d 64 4d 61 78 3b | 0d 09 09 63 6c 69 70 70 |n=-dMax;|...clipp|
|00003ef0| 65 64 53 64 31 3d 30 2e | 38 35 3b 0d 09 09 62 72 |edSd1=0.|85;...br|
|00003f00| 65 61 6b 3b 0d 09 63 61 | 73 65 20 6b 47 61 75 73 |eak;..ca|se kGaus|
|00003f10| 73 69 61 6e 50 64 66 3a | 0d 09 09 64 4d 61 78 3d |sianPdf:|...dMax=|
|00003f20| 32 2a 63 6c 69 70 70 65 | 64 53 64 3b 0d 09 09 64 |2*clippe|dSd;...d|
|00003f30| 4d 69 6e 3d 2d 64 4d 61 | 78 3b 0d 09 09 63 6c 69 |Min=-dMa|x;...cli|
|00003f40| 70 70 65 64 53 64 31 3d | 30 2e 37 33 37 3b 0d 09 |ppedSd1=|0.737;..|
|00003f50| 09 62 72 65 61 6b 3b 0d | 09 7d 0d 09 2f 2f 20 68 |.break;.|.}..// h|
|00003f60| 69 67 68 20 61 6e 64 20 | 6c 6f 77 20 61 72 65 20 |igh and |low are |
|00003f70| 74 68 65 20 65 78 74 72 | 65 6d 65 73 20 6f 66 20 |the extr|emes of |
|00003f80| 74 68 65 20 70 64 66 2e | 0d 09 2f 2f 20 54 68 65 |the pdf.|..// The|
|00003f90| 20 68 69 67 68 2d 6c 6f | 77 20 64 69 66 66 65 72 | high-lo|w differ|
|00003fa0| 65 6e 63 65 20 69 73 20 | 6d 6f 72 65 20 69 6d 70 |ence is |more imp|
|00003fb0| 6f 72 74 61 6e 74 20 74 | 68 61 6e 20 74 68 65 20 |ortant t|han the |
|00003fc0| 61 62 73 6f 6c 75 74 65 | 20 76 61 6c 75 65 20 6f |absolute| value o|
|00003fd0| 66 20 65 69 74 68 65 72 | 2e 0d 09 61 73 73 65 72 |f either|...asser|
|00003fe0| 74 28 64 4d 61 78 3e 3d | 64 4d 69 6e 29 3b 0d 09 |t(dMax>=|dMin);..|
|00003ff0| 6c 6f 77 3d 4d 41 58 28 | 72 6f 75 6e 64 28 6d 65 |low=MAX(|round(me|
|00004000| 61 6e 2b 64 4d 69 6e 29 | 2c 2a 6d 69 6e 50 74 72 |an+dMin)|,*minPtr|
|00004010| 29 3b 0d 09 68 69 67 68 | 3d 4d 49 4e 28 72 6f 75 |);..high|=MIN(rou|
|00004020| 6e 64 28 6c 6f 77 2b 28 | 64 4d 61 78 2d 64 4d 69 |nd(low+(|dMax-dMi|
|00004030| 6e 29 29 2c 2a 6d 61 78 | 50 74 72 29 3b 0d 09 6c |n)),*max|Ptr);..l|
|00004040| 6f 77 3d 4d 41 58 28 72 | 6f 75 6e 64 28 68 69 67 |ow=MAX(r|ound(hig|
|00004050| 68 2d 28 64 4d 61 78 2d | 64 4d 69 6e 29 29 2c 2a |h-(dMax-|dMin)),*|
|00004060| 6d 69 6e 50 74 72 29 3b | 0d 09 69 66 28 6c 6f 77 |minPtr);|..if(low|
|00004070| 3d 3d 68 69 67 68 20 26 | 26 20 63 6c 69 70 70 65 |==high &|& clippe|
|00004080| 64 53 64 3e 30 29 7b 0d | 09 09 69 66 28 68 69 67 |dSd>0){.|..if(hig|
|00004090| 68 3c 2a 6d 61 78 50 74 | 72 29 68 69 67 68 2b 2b |h<*maxPt|r)high++|
|000040a0| 3b 0d 09 09 65 6c 73 65 | 20 69 66 28 6c 6f 77 3e |;...else| if(low>|
|000040b0| 2a 6d 69 6e 50 74 72 29 | 6c 6f 77 2d 2d 3b 0d 09 |*minPtr)|low--;..|
|000040c0| 7d 0d 09 2a 6d 69 6e 50 | 74 72 3d 6c 6f 77 3b 0d |}..*minP|tr=low;.|
|000040d0| 09 2a 6d 61 78 50 74 72 | 3d 68 69 67 68 3b 0d 09 |.*maxPtr|=high;..|
|000040e0| 2a 75 6e 63 6c 69 70 70 | 65 64 53 64 50 74 72 3d |*unclipp|edSdPtr=|
|000040f0| 63 6c 69 70 70 65 64 53 | 64 2f 63 6c 69 70 70 65 |clippedS|d/clippe|
|00004100| 64 53 64 31 3b 0d 7d 00 | 00 00 00 00 00 00 00 00 |dSd1;.}.|........|
|00004110| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004120| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004130| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004140| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004150| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004160| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004170| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004180| 00 00 01 00 00 00 01 76 | 00 00 00 76 00 00 00 52 |.......v|...v...R|
|00004190| 00 04 00 00 00 07 00 00 | 00 03 00 00 00 00 00 03 |........|........|
|000041a0| 00 00 00 08 00 00 00 03 | 00 00 00 00 00 06 00 00 |........|........|
|000041b0| 0e 4e 6f 69 73 65 50 64 | 66 46 69 6c 6c 2e 63 46 |.NoisePd|fFill.cF|
|000041c0| 02 00 02 00 54 45 58 54 | 43 57 49 45 01 00 00 3c |....TEXT|CWIE...<|
|000041d0| 02 00 54 45 58 54 43 57 | 49 45 01 00 00 3c 03 c0 |..TEXTCW|IE...<..|
|000041e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000041f0| 00 00 ab 9a f2 31 00 00 | 40 87 00 00 01 c8 00 02 |.....1..|@.......|
|00004200| 67 74 6f 70 6c 65 76 00 | 02 3f 6e 72 00 02 30 6e |gtoplev.|.?nr..0n|
|00004210| 63 00 01 6a 6a 00 03 d4 | 6c 65 76 00 be ab ba eb |c..jj...|lev.....|
|00004220| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004230| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004240| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004250| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 01 00 14 |........|........|
|00004260| 00 01 00 00 02 e5 70 79 | 72 6e 75 6d 70 69 78 00 |......py|rnumpix.|
|00004270| 00 00 fe ed be ad 00 00 | 00 00 00 00 11 20 00 00 |........|..... ..|
|00004280| 00 00 00 04 00 01 00 01 | 00 00 00 48 00 09 4d 6f |........|...H..Mo|
|00004290| 6e 61 63 6f 00 00 00 00 | 01 9a f4 10 00 00 00 00 |naco....|........|
|000042a0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 06 |........|........|
|000042b0| 00 04 00 72 00 8e 02 46 | 02 fc 00 72 00 8e 02 46 |...r...F|...r...F|
|000042c0| 02 fc ad 88 be f2 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000042d0| 00 00 01 00 00 00 00 1e | 00 72 00 8e 02 46 02 fc |........|.r...F..|
|000042e0| 00 72 00 8e 02 46 02 fc | 00 00 00 00 00 00 00 00 |.r...F..|........|
|000042f0| 00 00 00 00 00 00 00 00 | 01 00 00 00 01 76 00 00 |........|.....v..|
|00004300| 00 76 00 00 00 52 01 8e | e8 c8 3c 3a 00 00 00 1c |.v...R..|..<:....|
|00004310| 00 52 00 01 4d 57 42 42 | 00 00 00 12 4d 50 53 52 |.R..MWBB|....MPSR|
|00004320| 00 01 00 1e 03 f0 ff ff | 00 00 00 00 00 00 00 00 |........|........|
|00004330| 03 ed ff ff 00 00 00 08 | 00 00 00 00 03 f0 ff ff |........|........|
|00004340| 00 00 00 54 01 91 43 f4 | 00 00 00 00 00 00 00 00 |...T..C.|........|
|00004350| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004360| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00004370| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+